what determines controller action ruby rails -
at https://www.codecademy.com/en/courses/learn-rails/lessons/start/exercises/start-views, controll action described 'pages#home':
well done! when user visits http://localhost:8000/welcome, route 'welcome' => 'pages#home' tell rails send request pages controller's home action.
but when made controller did rails generate controller pages
uppercase.
pages_controller.rb:
class pagescontroller < applicationcontroller def home end end
is
pages
part ofpages#home
determined first part ofpages_controller.rb
, ignoring_controller.rb
end?what happens if change
pages_controller.rb
renamedpages_controller.rb
leave class name pagescontroller?
thank you
- yes. ,
#home
"action" in pagescontroller - you
uninitialized constant pagescontroller
error
so, controllers should in form namecontroller
defined in name_controller.rb
, , actions public methods in namecontroller
.
Comments
Post a Comment