Skip to content

Instantly share code, notes, and snippets.

@jcalvert
Created June 5, 2012 15:42
Show Gist options
  • Save jcalvert/2875821 to your computer and use it in GitHub Desktop.
Save jcalvert/2875821 to your computer and use it in GitHub Desktop.
Nested with_options
GET /:locale/services/foo/:name {:action=>"config", :controller=>"services/foo"}
GET /:locale/services/bar/:name {:action=>"config", :controller=>"services/bar"}
ActionController::Routing::Routes.draw do |map|
map.with_options(:path_prefix => ':locale/services') do |services|
services.with_options(:controller => "services/foo") do |service|
service.connect '/foo/:name', :action => :config, :conditions => { :method => :get }
end
services.with_options(:controller => "services/bar") do |service|
service.connect '/bar/:name', :action => :config, :conditions => { :method => :get }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment