I'm tring to setup a Route like so:
GET /settings/ PUT /settings/ GET /settings/photos PUT /settings/photos
This is the routing code that I have setup for it:
#I just do this for code reuse
get = { :method => :get }
put = { :method => :put }
pub.settings '/settings', :controller => :settings, :action => :index, :conditions => get
pub.with_options :controller => :settings, :path_prefix => "/settings", :name_prefix => "settings_" do |settings|
settings.update '', :action => :update, :conditions => put
settings.photos '/photos', :action => :photos, :conditions => get
settings.photos_update '/photos', :action => :photos_update, :conditions => :put
end
This works, but if you notice that the first route "pub.settings" is outside of the mapped_options block.
If I were todo
pub.with_options :controller => :settings, :path_prefix => "/settings", :name_prefix => "settings_" do |settings|
settings.root '', :action => :index, :conditions => get
settings.update '', :action => :update, :conditions => put
settings.photos '/photos', :action => :photos, :conditions => get
settings.photos_update '/photos', :action => :photos_update, :conditions => :put
end
Then I would get (in rake routes) the path to settings would be "settings_root_path" and not "settings_path"
Does anyone know how to include it into the block and still have the routing function name as "settings_path" ?