class ActiveAdmin::DSL
users of Active Admin
are instance eval’d. This is the central place for the API given to
The Active Admin DSL. This class is where all the registration blocks
def action_item(options = {}, &block)
-
options
(Hash
) -- valid keys include:
def action_item(options = {}, &block) config.add_action_item(options, &block) end
def config
end
config.sort_order = "id_desc"
ActiveAdmin.register Post do
eg:
modify options:
currently. You can use this within your registration blocks to
The instance of ActiveAdmin::Config that's being registered
def config @config end
def controller(&block)
end
end
end
# Method gets added to Admin::PostsController
def some_method_on_controller
controller do
ActiveAdmin.register Post do
Example:
block, it will be eval'd in the controller
Returns the controller for this resource. If you pass a
def controller(&block) @config.controller.class_eval(&block) if block_given? @config.controller end
def menu(options = {})
def menu(options = {}) config.menu(options) end
def run_registration_block(config, &block)
def run_registration_block(config, &block) @config = config instance_eval &block end
def sidebar(name, options = {}, &block)
def sidebar(name, options = {}, &block) config.sidebar_sections << ActiveAdmin::SidebarSection.new(name, options, &block) end