1

I am working with "One month rails" (rails 4), used 'rails generate controller pages home' for new home page. It all seems fine but the local host page is still stating "welcome aboard You’re riding Ruby on Rails!" and not the new home page as expected. any idea what might be the problem?

4 Answers4

1
# config/routes.rb
root to: 'pages#home'
itsnikolay
  • 17,415
  • 4
  • 65
  • 64
  • Thanks. did that but I get this error: ExecJS::RuntimeError in Pages#home Extracted source (around line #6): 3 4 5 6 7 8 9 Pinteresting <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> . tried using this answer-http://stackoverflow.com/questions/12520456/execjsruntimeerror-on-windows-trying-to-follow-rubytutorial - no luck. – user3370329 Mar 02 '14 at 11:11
  • We have solved the current issue. Need go deeper. Could you show the full listing of the errror? – itsnikolay Mar 02 '14 at 11:14
  • Thanks and Yes. I get **ExecJS::RuntimeError in Pages#home ** , Extracted source (around line #6): 3 4 5 6 7 8 9 Pinteresting <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> – user3370329 Mar 02 '14 at 11:26
  • also- removing the line //= require_tree . from application.js didn't work. – user3370329 Mar 02 '14 at 11:30
  • add in `Gemfile` the following line `gem 'therubyracer'` then run `bundle install` – itsnikolay Mar 02 '14 at 11:32
  • 1
    thank you. had trouble with the gem rubytracer, it couldn't be installed and bundle on my computer, but it works fine on cloud IDE. – user3370329 Mar 02 '14 at 18:16
1

There are 3 steps that should be done:

  • map the new controller and action to your root_path in your config routes (as itsnikolay suggests )
  • remove the default index page public/index.html (as ardochhigh suggests)
  • restart you development server
Community
  • 1
  • 1
xlembouras
  • 8,215
  • 4
  • 33
  • 42
0

You should change your "root" mapping realtionship in config/routes.rb. Make sure "root" point to the page (controller#action) you want.

lalameat
  • 754
  • 3
  • 10
0

You need to delete the default index page.

Go to your Rails root directory and delete public/index.html

rm public/index.html
port5432
  • 5,889
  • 10
  • 60
  • 97