Class: RailsAdmin::MainController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsAdmin::MainController
- Includes:
- ActionView::Helpers::TextHelper, ApplicationHelper, MainHelper
- Defined in:
- app/controllers/rails_admin/main_controller.rb
Instance Attribute Summary
Attributes inherited from ApplicationController
#abstract_model, #authorization_adapter, #model_config, #object
Instance Method Summary collapse
- #bulk_action ⇒ Object
- #list_entries(model_config = @model_config, auth_scope_key = :index, additional_scope = get_association_scope_from_params, pagination = !(params[:associated_collection] || params[:all] || params[:bulk_ids]))) ⇒ Object
Methods included from ApplicationHelper
#action, #actions, #authorized?, #breadcrumb, #bulk_menu, #current_action, #current_action?, #edit_user_link, #flash_alert_class, #handle_asset_dependency_error, #image_tag, #logout_method, #logout_path, #main_navigation, #menu_for, #navigation, #root_navigation, #static_navigation, #wording_for
Methods included from MainHelper
#filterable_fields, #get_indicator, #ordered_filter_options, #ordered_filters, #rails_admin_form_for
Methods inherited from ApplicationController
#_current_user, #get_model, #get_object, #to_model_name
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
41 42 43 44 45 46 47 48 |
# File 'app/controllers/rails_admin/main_controller.rb', line 41 def method_missing(name, *args, &block) action = RailsAdmin::Config::Actions.find(name.to_sym) if action action_missing name, *args, &block else super end end |
Instance Method Details
#bulk_action ⇒ Object
11 12 13 14 |
# File 'app/controllers/rails_admin/main_controller.rb', line 11 def bulk_action get_model process(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(:bulkable, controller: self, abstract_model: @abstract_model).collect(&:route_fragment)) end |
#list_entries(model_config = @model_config, auth_scope_key = :index, additional_scope = get_association_scope_from_params, pagination = !(params[:associated_collection] || params[:all] || params[:bulk_ids]))) ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/controllers/rails_admin/main_controller.rb', line 16 def list_entries(model_config = @model_config, auth_scope_key = :index, additional_scope = get_association_scope_from_params, pagination = !(params[:associated_collection] || params[:all] || params[:bulk_ids])) scope = model_config.scope auth_scope = @authorization_adapter&.query(auth_scope_key, model_config.abstract_model) scope = scope.merge(auth_scope) if auth_scope scope = scope.instance_eval(&additional_scope) if additional_scope get_collection(model_config, scope, pagination) end |