Skip to content

Commit

Permalink
Connect vue with rails
Browse files Browse the repository at this point in the history
  • Loading branch information
bonyiii committed Apr 11, 2021
1 parent ebea370 commit a1083bd
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
4 changes: 4 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class HomeController < ApplicationController
def index
end
end
2 changes: 2 additions & 0 deletions app/helpers/home_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module HomeHelper
end
3 changes: 2 additions & 1 deletion app/javascript/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export default {
data: function () {
return {
message: "Hello Vue!"
message: "Hello to my first Vue and Rails application!"
}
}
}
Expand All @@ -18,5 +18,6 @@ export default {
p {
font-size: 2em;
text-align: center;
color: red;
}
</style>
3 changes: 3 additions & 0 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= javascript_pack_tag :hello_vue %>


2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html

root 'home#index'
end
15 changes: 15 additions & 0 deletions spec/helpers/home_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

# Specs in this file have access to a helper object that includes
# the HomeHelper. For example:
#
# describe HomeHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe HomeHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
7 changes: 7 additions & 0 deletions spec/requests/home_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rails_helper'

RSpec.describe "Homes", type: :request do
describe "GET /index" do
pending "add some examples (or delete) #{__FILE__}"
end
end

0 comments on commit a1083bd

Please sign in to comment.