Skip to content

Instantly share code, notes, and snippets.

@wethu
Created April 7, 2015 23:00
Show Gist options
  • Select an option

  • Save wethu/52d49d380177720349d0 to your computer and use it in GitHub Desktop.

Select an option

Save wethu/52d49d380177720349d0 to your computer and use it in GitHub Desktop.
# ...
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
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment