Class: ActiveAdmin::Views::IndexAsBlock

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/views/index_as_block.rb

Overview

Index as a Block

If you want to fully customize the display of your resources on the index screen, Index as a Block allows you to render a block of content for each resource.

index :as => :block do |product|
  div :for => product do
    h2 auto_link(product.title)
    div do
      simple_format product.description
    end
  end
end

Instance Method Summary collapse

Methods inherited from Component

#default_class_name, #initialize, #tag_name

Constructor Details

This class inherits a constructor from ActiveAdmin::Component

Instance Method Details

#build(page_presenter, collection) ⇒ Object



21
22
23
24
25
# File 'lib/active_admin/views/index_as_block.rb', line 21

def build(page_presenter, collection)
  collection.each do |obj|
    instance_exec(obj, &page_presenter.block)
  end
end