Module: ActiveAdmin::ResourceController::Decorators

Included in:
ActiveAdmin::ResourceController
Defined in:
lib/active_admin/resource_controller/decorators.rb

Defined Under Namespace

Classes: Wrapper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.undecorate(resource) ⇒ Object (protected)


19
20
21
22
23
24
25
# File 'lib/active_admin/resource_controller/decorators.rb', line 19

def self.undecorate(resource)
  if resource.respond_to?(:decorated?) && resource.decorated?
    resource.model
  else
    resource
  end
end

Instance Method Details

#apply_collection_decorator(collection) ⇒ Object (protected)


11
12
13
14
15
16
17
# File 'lib/active_admin/resource_controller/decorators.rb', line 11

def apply_collection_decorator(collection)
  if decorate?
    collection_decorator.decorate collection, with: decorator_class
  else
    collection
  end
end

#apply_decorator(resource) ⇒ Object (protected)


7
8
9
# File 'lib/active_admin/resource_controller/decorators.rb', line 7

def apply_decorator(resource)
  decorate? ? decorator_class.new(resource) : resource
end