我的Rails应用程序路由看起来像这样:
match 'Events/New' => 'event#new'
match 'Events/:date' => 'event#show', :date => /[A-Z][a-z]{2}-\d{2}-\d{4}/
match 'Events/:date/Venue' => 'event#venue', :date => /[A-Z][a-z]{2}-\d{2}-\d{4}/
match 'Events/:date/Speakers' => 'event#speakers', :date => /[A-Z][a-z]{2}-\d{2}-\d{4}/
有没有办法筑巢并清理它?我怀疑它正在运行正则表达式:日期多次,而嵌套理论上可以让它运行一次。
答案 0 :(得分:0)
看看:http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing scope
应该可以解决您的问题!
类似的东西:
scope :module => "events" do
// ...
end