Please can somebody help within the following section Saving Data/Section 3.2. It is asking me to carry out the following:
“In the routes file, create a route that maps the URL /messages to the Messages controller’s index action”.
Please can somebody identify the code required to help my understanding.
I have the exact same doubt, where is the routes file??? I can’t find it, and how do you everything else???
I think is this:
get ‘/messages’ => ‘messages#index’
In the config/routes.rb file they explain how to set a route and then map it:
Example of regular route:
get ‘products/:id’ => ‘catalog#view’
I’m no expert though and it would be nice if someone explained this in detail
This did it for me. get ‘messages’=>‘messages#index’. We are essentially saying that the route configured so that all messages will go to http://localhost:8000/index.html/messages
Am struggling with this course - but I can tell you routes file is in the config, routes.rb.
Hope this helps.
Thank you Taiyari,
I had to redo this exercise instead of codecademy giving the answers, otherwise next time I come to write this action again I won’t know what do - thank you for the tip below (was lost seeing so many instructions within the routes.rb folder).
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.