wethu
4/7/2015 - 11:00 PM

routes.rb

# ...

foos = [:bar, :baz]

namespace :foo do
  foos.each do |f|
    get "#{f.to_str}/new" => 'controller#new', :as => "new_#{f.to_str}"
  end
end

# rake routes 

# foo_new_bar GET    /foo/bar/new(.:format) {:controller=>"foo/controller", :action=>"new"}
# foo_new_baz GET    /foo/baz/new(.:format) {:controller=>"foo/controller", :action=>"new"}

# I want: new_foo_bar_path instead of foo_new_bar_path

# ...