Sha256: 8a339520c7cff790c73f983f4900dd9c1f8006126f19a2d7ea057df336e7b903

Contents?: true

Size: 669 Bytes

Versions: 31

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true
module ActiveAdmin
  class ResourceController < BaseController
    module ResourceClassMethods

      # Override the default `resource_class` class and instance
      # methods to only return the class defined in the instance
      # of ActiveAdmin::Resource
      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

    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
activeadmin-4.0.0.beta14 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta13 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta12 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.5 lib/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta11 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.4 lib/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta10 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta9 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.3 lib/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta8 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta7 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.2 lib/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta6 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.1 lib/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta5 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta4 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta3 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta2 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-4.0.0.beta1 app/controllers/active_admin/resource_controller/resource_class_methods.rb
activeadmin-3.2.0 lib/active_admin/resource_controller/resource_class_methods.rb