Module: Adminable::Configuration
- Defined in:
- lib/adminable/configuration.rb
Class Method Summary collapse
- .redirect_root_path ⇒ Object
-
.resources ⇒ Array
Finds all controllers from ‘app/controllers/adminable` directory.
- .resources_paths ⇒ Object
Class Method Details
.redirect_root_path ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/adminable/configuration.rb', line 20 def self.redirect_root_path if resources.any? resources.first.name else Rails.application.routes.url_helpers.root_path end end |
.resources ⇒ Array
Finds all controllers from ‘app/controllers/adminable` directory
5 6 7 8 9 10 11 12 13 |
# File 'lib/adminable/configuration.rb', line 5 def self.resources resources_paths.map do |resource_path| Adminable::Resource.new( resource_path.to_s.split('adminable/').last.sub( /_controller\.rb$/, '' ) ) end end |
.resources_paths ⇒ Object
15 16 17 18 |
# File 'lib/adminable/configuration.rb', line 15 def self.resources_paths Dir[Rails.root.join('app/controllers/adminable/**/*_controller.rb')] .reject { |f| f['app/controllers/adminable/application_controller.rb'] } end |