Class: Para::Admin::BaseController

Inherits:
Para::ApplicationController show all
Includes:
BaseHelper
Defined in:
app/controllers/para/admin/base_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseHelper

#find_partial_for, #find_relation_name_for, #flash_message, #registered_components_options, #resource_title_for, #template_path_lookup

Methods included from Helpers::ResourceName

#resource_name

Methods inherited from Para::ApplicationController

#admin?

Class Method Details

.cancan_resource_classObject

Override cancan controlelr resource class to avoid attributes assignation issues with resources



38
39
40
# File 'app/controllers/para/admin/base_controller.rb', line 38

def self.cancan_resource_class
  Para::ControllerResource
end

.load_and_authorize_component(options = {}) ⇒ Object



46
47
48
49
50
# File 'app/controllers/para/admin/base_controller.rb', line 46

def self.load_and_authorize_component(options = {})
  before_action do
    load_and_authorize_component(options)
  end
end

Instance Method Details

#current_abilityObject



23
24
25
26
27
# File 'app/controllers/para/admin/base_controller.rb', line 23

def current_ability
  @current_ability ||= if (class_name = Para::Config.ability_class_name)
    class_name.constantize.new(current_admin)
  end
end

#current_adminObject



17
18
19
20
21
# File 'app/controllers/para/admin/base_controller.rb', line 17

def current_admin
  @current_admin ||= if Para.config.current_admin_method
    send(Para.config.current_admin_method)
  end
end