I've created a DB and a table within that DB called genre.
Now when I try to connect to this using the URL, I get the following error message:
Routing Error
No route matches "/genre" with 开发者_运维技巧{:method=>:get}
Thanks for your help in advance.
I think that /genre should be /genres
I just wrote an app from scratch to work with genres and this is my routes file:
ActionController::Routing::Routes.draw do |map|
map.resources :genres
# these last two lines should go away but I left them in
# here because my example worked as is.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
So you would want to make sure that you are using the pural form of the noun genre.
Also rake routes
is a great way to see what your routes are setup as.
As @Jens Fahnenbruck said, you need to set up your route in config/routes.rb
.
If you want to find out what routes exist on your app, type rake routes
into the command line.
精彩评论