Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

shageman commented Jan 27, 2015

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