Rails routing aliasing and namespaces

Posted by kain on Stack Overflow See other posts from Stack Overflow or by kain
Published on 2010-03-06T04:57:28Z Indexed on 2010/03/29 12:53 UTC
Read the original article Hit count: 154

Filed under:

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.

© Stack Overflow or respective owner

Related posts about ruby-on-rails