class ActiveAdmin::Resource
by calling the #active_admin_config method.
The instance of the current resource is available in ResourceController and views
a new Resource instance within the given Namespace.
When you register a resource (ActiveAdmin.register Post) you are actually creating
Resource is the primary data storage for resource configuration in Active Admin
def admin_notes?
def admin_notes? admin_notes.nil? ? ActiveAdmin.admin_notes : admin_notes end
def belongs_to(target, options = {})
def belongs_to(target, options = {}) @belongs_to = Resource::BelongsTo.new(self, target, options) controller.belongs_to(target, options.dup) end
def belongs_to?
def belongs_to? !belongs_to_config.nil? end
def belongs_to_config
def belongs_to_config @belongs_to end
def clear_collection_actions!
def clear_collection_actions! @collection_actions = [] end
def clear_member_actions!
def clear_member_actions! @member_actions = [] end
def csv_builder
def csv_builder @csv_builder || default_csv_builder end
def decorator_class
def decorator_class ActiveSupport::Dependencies.constantize(decorator_class_name) if decorator_class_name end
def default_csv_builder
def default_csv_builder @default_csv_builder ||= CSVBuilder.default_for_resource(resource_class) end
def default_options
def default_options { :sort_order => "#{resource_class.respond_to?(:primary_key) ? resource_class.primary_key : 'id'}_desc" } end
def defined_actions
def defined_actions controller.instance_methods.map { |m| m.to_sym } & ResourceController::ACTIVE_ADMIN_ACTIONS end
def include_in_menu?
def include_in_menu? super && !(belongs_to? && !belongs_to_config.optional?) end
def resource
def resource resource_class end
def resource_class
The class this resource wraps. If you register the Post model, Resource#resource_class
def resource_class ActiveSupport::Dependencies.constantize(resource_class_name) end
def resource_quoted_column_name(column)
def resource_quoted_column_name(column) resource_class.connection.quote_column_name(column) end
def resource_table_name
def resource_table_name resource_class.quoted_table_name end
def route_collection_path
Returns a symbol for the route to use to get to the
def route_collection_path route = super # Handle plural resources. if controller.resources_configuration[:self][:route_collection_name] == controller.resources_configuration[:self][:route_instance_name] route = route.to_s.gsub('_path', '_index_path').to_sym end route end
def route_instance_path
def route_instance_path [route_prefix, controller.resources_configuration[:self][:route_instance_name], 'path'].compact.join('_').to_sym end