2008年11月5日 星期三

routes,conditions,requirement


map.with_options :conditions => { :subdomain => MIRRORS_REGEX} do |goyou_map|
goyou_map.target 'target/:type/:type_id/:sort',
:controller => 'target', :action => 'index',
:defaults => { :sort => 'target_id'
},
:requirements => { :type => /(category)|(concept)/,
:sort => /(target_id)|(change_rate)|(volume)/
}
end

conditions <= 必須符合這個條件才會apply, 不符合就繼續往下找
requirement <= 會符合這個 rule, 但是 paramter 需符合 requirement

沒有留言: