這裏是我的Rails 2條路線:有沒有更好的方式來做Rails 3路線中的with_options?
map.with_options :controller => 'foo', :conditions => { :method => :post } do |foo|
foo.one 'one', :action => 'one'
foo.two 'two', :action => 'two'
foo.with_options :special_flag => 'true', :path_prefix => 'special_prefix',
:conditions => { :method => :get } do |bar|
bar.three '', :action => 'for_blank'
bar.four 'another', :action => 'for_another'
end
end
如何轉換這種事到Rails 3?只需以同樣的方式繼續使用with_options?它成爲在某些情況下,因爲與其做
match '' => 'foo#for_blank'
wordier我做
match '', :action => 'for_blank'
甜美。我也可以通過並且做'post'one''和'post'two'',是嗎? – 2010-12-14 02:34:46
@John:是的。 – 2010-12-14 05:05:21