Module: ActiveAdmin::ResourceController::ResourceClassMethods

Included in:
ActiveAdmin::ResourceController
Defined in:
app/controllers/active_admin/resource_controller/resource_class_methods.rb

Instance Method Summary collapse

Instance Method Details

#override_resource_class_methods!Object

Override the default ‘resource_class` class and instance methods to only return the class defined in the instance of ActiveAdmin::Resource



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/active_admin/resource_controller/resource_class_methods.rb', line 9

def override_resource_class_methods!
  class_exec do
    def self.resource_class=(klass); end

    def self.resource_class
      @active_admin_config ? @active_admin_config.resource_class : nil
    end

    private

    def resource_class
      self.class.resource_class
    end
  end
end