class ActiveAdmin::ResourceController::Decorators::Wrapper
Public Class Methods
wrap(decorator)
click to toggle source
# File lib/active_admin/resource_controller/decorators.rb, line 54 def self.wrap(decorator) collection_decorator = find_collection_decorator(decorator) if draper_collection_decorator? collection_decorator name = "#{collection_decorator.name} of #{decorator} + ActiveAdmin" @cache[name] ||= wrap! collection_decorator, name else collection_decorator end end
Private Class Methods
draper_collection_decorator()
click to toggle source
# File lib/active_admin/resource_controller/decorators.rb, line 95 def self.draper_collection_decorator ::Draper::CollectionDecorator end
draper_collection_decorator?(decorator)
click to toggle source
# File lib/active_admin/resource_controller/decorators.rb, line 89 def self.draper_collection_decorator?(decorator) decorator && decorator <= draper_collection_decorator rescue NameError false end
find_collection_decorator(decorator)
click to toggle source
Draper::CollectionDecorator was introduced in 1.0.0 Draper::Decorator#collection_decorator_class was introduced in 1.3.0
# File lib/active_admin/resource_controller/decorators.rb, line 79 def self.find_collection_decorator(decorator) if Dependency.draper? '>= 1.3.0' decorator.collection_decorator_class elsif Dependency.draper? '>= 1.0.0' draper_collection_decorator else decorator end end
wrap!(parent, name)
click to toggle source
# File lib/active_admin/resource_controller/decorators.rb, line 67 def self.wrap!(parent, name) ::Class.new parent do delegate :reorder, :page, :current_page, :total_pages, :limit_value, :total_count, :total_pages, :to_key, :group_values, :except, :find_each, :ransack define_singleton_method(:name) { name } end end