Open geekelo opened 1 month ago
This file configures the ActiveAdmin interface for managing Card::Detail
records in your Ruby on Rails application. Here’s a breakdown of what each part of the file does:
card_detail.rb
Card::Detail
model with ActiveAdmin, creating an admin interface for managing card details.Card::Detail
resource under the "Cards" menu with the label "Details" in the ActiveAdmin interface. This helps in organizing the admin panel by grouping related resources together.status
attribute is permitted for mass assignment through the ActiveAdmin interface. This is a security measure to prevent unwanted or accidental changes to other attributes.status
is allowed.Defines the columns and layout for the index (list) view of Card::Detail
records.
selectable_column: Adds a checkbox for selecting multiple records, useful for batch actions.
id_column: Displays the ID of each Card::Detail
record.
column :user: Displays the associated user.
column :card_number do |cd| ... end: Displays the card number by accessing the card_number
method on each Card::Detail
instance.
column :account_number do |cd| ... end: Displays the account number by accessing the jdb_acc_num
method on each Card::Detail
instance.
column :status: Displays the status of the card.
column :activation_date: Displays the activation date of the card.
column :created_at: Displays the date the record was created.
actions: Adds default actions (view, edit, delete) for each record.
Customizes the show view for individual Card::Detail
records, displaying detailed information.
attributes_table do ... end: Displays the attributes of the Card::Detail
record in a table format.
row :card_with_selfie do |cd| ... end:
attachment
association, and the link opens in a new tab (target: '_blank'
).Customizes the form for creating and editing Card::Detail
records.
f.inputs do ... end: Contains the input fields for the form.
select
) input for the status
attribute, with options populated from SetStatus::STATUS.values
.f.actions: Adds the default form submission buttons (Save, Cancel).
Card::Detail
records are managed within the ActiveAdmin interface, including the permitted parameters, how records are displayed in list and show views, and how forms are structured.status
field is currently permitted for editing.This setup is useful for administrators who need to manage card details efficiently while ensuring that only certain fields, like the status, can be modified.
FILE