Class: ActiveAdmin::Views::IndexAsBlock

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

Overview

Simplest rendering possible. Calls the block for each element in the collection.

Example:

ActiveAdmin.register Post do
  index :as => :block do |post|
    # render the post partial (app/views/admin/posts/_post)
    render 'post', :post => post 
  end
end

Instance Method Summary collapse

Methods inherited from Component

#initialize, #tag_name

Constructor Details

This class inherits a constructor from ActiveAdmin::Component

Instance Method Details

#build(page_config, collection) ⇒ Object



16
17
18
19
20
# File 'lib/active_admin/views/index_as_block.rb', line 16

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