Skip to content

Instantly share code, notes, and snippets.

@kulesa
Forked from dhh/gist:2492118
Created April 27, 2012 09:44
Show Gist options
  • Save kulesa/2507892 to your computer and use it in GitHub Desktop.
Save kulesa/2507892 to your computer and use it in GitHub Desktop.
nested routes for namespaces
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes", "#{@scope[:shallow_prefix]}", "#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :projects # => config/routes/projects.rb
namespace :admin do
draw :projects # => config/routes/admin/projects.rb
end
root to: 'projects#index'
end
@kulesa
Copy link
Author

kulesa commented May 9, 2012

Hey, that's awesome! I've updated my routes file and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment