module ActiveAdmin
Note for posterity:
Here we have two core customizations on top of Formtastic. First, this allows you to build forms in the AA DSL
without dealing with the HTML return value of individual form methods (hence the form_buffers
object). Second, this provides an intuitive way to build has_many associated records in the same form.
This is a common set of Formtastic overrides needed to build a filter form that lets you select from a set of search methods for a given attribute.
Your class must declare available filters for this module to work. Those filters must be recognizable by Ransack. For example:
class FilterNumericInput < ::Formtastic::Inputs::NumberInput include FilterBase include FilterBase::SearchMethodSelect filter :equals, :greater_than, :less_than end
Load the model as soon as it’s referenced. By that point, Rails & Kaminari will be ready
Constants
- Auth
Default
Authorization
permissions for Active Admin- DEFAULT_MENU
- Event
ActiveAdmin::Event
is set to a dispatcher- VERSION
Attributes
Public Class Methods
A callback is triggered each time (after) Active Admin loads the configuration files. This is an opportunity to hook into Resources after they’ve been loaded.
The block takes the current instance of [ActiveAdmin::Application]
Example:
ActiveAdmin.after_load do |app| app.namespaces.each do |name, namespace| puts "Namespace: #{name} loaded!" end end
@param [Block] block A block to call each time (after) AA loads resources
# File lib/active_admin.rb, line 113 def after_load(&block) ActiveAdmin::Event.subscribe ActiveAdmin::Application::AfterLoadEvent, &block end
A callback is triggered each time (before) Active Admin loads the configuration files. In development mode, this will happen whenever the user changes files. In production it only happens on boot.
The block takes the current instance of [ActiveAdmin::Application]
Example:
ActiveAdmin.before_load do |app| # Do some stuff before AA loads end
@param [Block] block A block to call each time (before) AA loads resources
# File lib/active_admin.rb, line 95 def before_load(&block) ActiveAdmin::Event.subscribe ActiveAdmin::Application::BeforeLoadEvent, &block end
Gets called within the initializer
# File lib/active_admin.rb, line 70 def setup application.setup! yield(application) application.prepare! end