Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/admin_space/route.rb
Instance Method Summary collapse
Instance Method Details
#admin_space(*args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/admin_space/route.rb', line 3 def admin_space *args namespace :admin, module: :admin_space do controller: :base do |admin| yield admin end # match ':type/:id', controller: :base, action: :show, constraints: { :id => /\d/ } # match ':type/(:action/(:id(.:format)))', controller: :base # List all model and build routes models = [] Dir.glob( 'app/models/*' ).each do |f| models << File.basename( f ).gsub( /^(.+).rb/, '\1') end models.each do |model| eval("resources :#{model.pluralize}, controller: :base") end end end |