开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜