Created
January 27, 2015 16:23
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternative to https://gist.github.com/fernandes/a641c3f19cda5b199943 for creating one admin experience from multiple engines.