Route to custom non-REST action
I have "Articles" controller with REST routing.
I need one more action for it:
/articles/demo
It does't belongs to REST.
It just renders separate page, without consuming any models, etc.
Current routes.rb is following:
map.re开发者_如何学Pythonsources :articles
map.connect "articles/demo", :controller => "articles", :action => "demo"
Unfortunately, it does't works.
I get:
Couldn't find Article with ID=demo
What's wrong here ?
it's because it's after your map.resources put it before. First in First choose
map.connect "articles/demo", :controller => "articles", :action => "demo"
map.resources :articles
精彩评论