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 
  1. is pages part of pages#home determined first part of pages_controller.rb, ignoring _controller.rb end?

  2. what happens if change pages_controller.rb renamedpages_controller.rb leave class name pagescontroller?

thank you

  1. yes. , #home "action" in pagescontroller
  2. you uninitialized constant pagescontroller error

so, controllers should in form namecontroller defined in name_controller.rb, , actions public methods in namecontroller.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -