3
什么时候应该使用:条件或:轨道布线中的要求?Rails路由:条件和:路由中的要求有什么区别?
这里有两个例子:
:条件
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
感谢您的快速回复。你太棒了。 – deb