I just started looking into Ruby on Rails and have been reading Dave Thomas’s and DHH’s “Agile Web Development with Rails.” The book is from 2005, so a lot of the code and Terminal commands are outdated, but I have managed to reach page 57 without too much hassle. On page 57, I have created an app named “depot” using Rails and now they want me to use its scaffolding functionality by issuing the following command:
ruby script/generate scaffold Product Admin
Since that didn’t work I figured the procedure has changed slightly within the last seven years, so it didn’t take me too many Google searches before I (successfully) fired off this command instead:
rails generate scaffold Product Admin
This seemed to work. At least I got the list with the green “create” words in Terminal and a new controller and model was added to my app. Now, the step is to start the server (easy) and go to localhost:3000/admin but now I get the infamous No route matches [GET] "/admin" and I don’t know why. I’ve uncommented match ':controller(/:action(/:id))(.:format)' from routes.rb, but it still throws the same error.
What have I missed?
You probably just need to add to your routes.rb:
or