【发布时间】:2009-12-07 19:40:48
【问题描述】:
什么时候应该在 rails 路由中使用 :conditions 或 :requirements?
这里有两个例子:
:条件
map.connect "/foo/:view/:permalink", :controller => "foo",
:action => "show", :view => /plain|fancy/,
:permalink => /[-a-z0-9]+/,
:conditions => { :method => :get }
end
:要求
map.connect 'posts/index/:page',
:controller => 'posts',
:action => 'index',
:requirements => {:page => /\d+/ },
:page => nil
end
【问题讨论】:
标签: ruby-on-rails routes