views:

58

answers:

1

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.

+1  A: 

I believe the , :controller => 'api/genres' option is your only approach. Only cleanup I can see is: map.namespace :mobile.

Dan Croak