Skip to content

Instantly share code, notes, and snippets.

@shageman
Created January 27, 2015 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shageman/c07ed2b46dceecdf53ea to your computer and use it in GitHub Desktop.
Save shageman/c07ed2b46dceecdf53ea to your computer and use it in GitHub Desktop.
Admin routes using components #cobra #cbra (with admin per engine, unique engine paths, and meta admin engine)
#routes.rb
mount Settings::Engine => "/settings"
mount Profile::Engine => "/profile"
mount MetaAdmin::Engine => "/admin"
# admin_settings/config/routes.rb
Settings::Engine.routes.draw do
resources :admin
#add other settings routes
end
# profile/config/routes.rb
Profile::Engine.routes.draw do
resources :admin
#add other profile routes
end
# in initializers in profile and settings engines:
if const_defined?("MetaAdmin", false)
MetaAdmin.adminable_components_paths << { ENGINE_NAME::Engine => "/admin" }
end
# then you could access
# /profiles/admin
# /settings/admin
# /admin
# and the meta-admin could create a unified interface for all admin protions of all components using `adminable_components_paths`
@shageman
Copy link
Author

Alternative to https://gist.github.com/fernandes/a641c3f19cda5b199943 for creating one admin experience from multiple engines.

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