Reputation: 5570
Given a simple namespaced route
map.namespace :api do |api|
api.resources :genres
end
how can I reuse this block but with another namespace?
Currently I'm achieving that by writing another routes hacked on the fly
map.with_options :name_prefix => 'mobile_', :path_prefix => 'mobile' do |mobile|
mobile.resources :genres, :controller => 'api/genres'
end
But it seems less than ideal.
Upvotes: 3
Views: 1047
Reputation: 1669
I believe the , :controller => 'api/genres' option is your only approach. Only cleanup I can see is: map.namespace :mobile.
Upvotes: 1