[Rails] ActiveAdmin - arb

Tags
Rails
Engineering
Created
Nov 1, 2023 03:28 AM
Edited
Oct 31, 2023
Description

What is arb

HTML Views in Ruby.

column

The column method can take a title as its first argument and data (:your_method) as its second (or first if no title provided). Column also takes a block.
table_for order.payments do
  column(:payment_type) { |payment| payment.payment_type.titleize }
  column "Received On",     :created_at
  column "Details & Notes", :payment_details
  column "Amount",          :amount_in_dollars
end

table_for

Table For provides the ability to create tables like those present in index_as_table. It takes a collection and a hash of options and then uses column to build the fields to show with the table.
 
It iterate the collection and inside that do-statement, you can access its attributes with :attr.
# irb(main):001:0> Books
# => #<Book title: "Book's title">

table_for assign[:books] do
	column "Title", :title
end

Source