Open geekelo opened 1 month ago
This code configures the admin interface for managing AirdropRecipient
records in an ActiveAdmin panel within a Ruby on Rails application. Here's a detailed breakdown of what this file does:
airdrop_recipient.rb
AirdropRecipient
model with ActiveAdmin, creating an admin interface for managing AirdropRecipient
records.destroy
action. This prevents users from deleting AirdropRecipient
records via the admin interface.airdrop
when querying AirdropRecipient
records, improving performance by reducing the number of database queries.AirdropRecipient
resource under the Stores
menu with the label Airdrop Recipients
in the ActiveAdmin interface. This organizes the admin panel by grouping related resources together.AirdropRecipient
records. These filters allow admins to search and filter records by various attributes, such as ID
, Airdrop ID
, Crypto Transfer ID
, Wallet Address
, Original Wallet Address
, Status
, and Active
status.:string
) and dropdowns (:select
).airdrop
, crypto_transfer
, participation
, wallet_address
, status
, etc.AirdropRecipient
records.id
, airdrop
, crypto_transfer
, user_email
, token_balance
, wallet_address
, status
, api_request_body
, participation
, balance
, ref1
, original_wallet_address
, and timestamps (created_at
, updated_at
).user_email
and api_request_body
columns are customized using blocks, providing specific logic for how these values are displayed:
user_email
is fetched from the associated record.api_request_body
generates a JSON string representing an API request, but only if the associated crypto_transfer
is not complete.AirdropRecipient
records.id
, airdrop
, crypto_transfer
, user_email
, and more.api_request_body
is conditionally generated and included in the CSV export.AirdropRecipient
record).default_main_content
to render the default content and adds an attributes_table
to display the user_email
attribute.AirdropRecipient
records.user_email
and api_request_body
attributes.destroy
action is disabled, preserving data integrity by preventing deletion of records through the admin interface.This setup provides a robust and customized interface for managing airdrop recipients in the application, with careful attention to security and performance.
FILE