Open geekelo opened 2 months ago
This ActiveAdmin configuration defines an interface for managing Limit
records within your application. The configuration provides a form for creating and updating records, and organizes these records under the "Configuration" menu with the label "Limits." Here's a detailed breakdown of the setup:
menu parent: 'Configuration', label: 'Limits'
:Limit
resource to the "Configuration" menu in ActiveAdmin with the label "Limits."permit_params :name, :slug, :amount, :units, :time_frame, :currency, :status
:config.sort_order = 'name_asc'
:Limit
resource, sorting the records by the name
field in ascending order.form do |f|
:
This block defines the form that will be used to create or edit Limit
records.
Form Fields:
f.input :name
: Input for the limit's name.
f.input :slug
: Input for the slug, typically a URL-friendly version of the name.
f.input :amount
: Input for the limit amount.
f.input :units
: Input for the units associated with the limit (e.g., transactions, dollars).
f.input :time_frame
: Input for the time frame over which the limit applies (e.g., daily, monthly).
f.input :currency
: Input for the currency associated with the limit.
f.input :status, as: :select, collection: ['active', 'inactive']
: A dropdown for selecting the status of the limit, with options for "active" and "inactive."
Form Actions:
f.actions
generates the submit and cancel buttons for the form.
This configuration creates a straightforward interface for managing Limit
records in your application via ActiveAdmin. It organizes the resource under the "Configuration" menu, allows admins to create or update limits with relevant attributes, and provides a clean and user-friendly form with input fields and a status selector. The default sorting by name helps administrators quickly locate specific limits in the index view.
FILE