lib/active_admin/resource.rb in activeadmin-0.4.4 vs lib/active_admin/resource.rb in activeadmin-0.5.0.pre
- old
+ new
@@ -45,10 +45,13 @@
attr_accessor :scope_to_association_method
# Set the configuration for the CSV
attr_writer :csv_builder
+ # Store a reference to the DSL so that we can dereference it during garbage collection.
+ attr_accessor :dsl
+
module Base
def initialize(namespace, resource_class, options = {})
@namespace = namespace
@resource_class_name = "::#{resource_class.name}"
@options = default_options.merge(options)
@@ -107,10 +110,15 @@
def clear_collection_actions!
@collection_actions = []
end
+ # Return only defined resource actions
+ def defined_actions
+ controller.instance_methods.map { |m| m.to_sym } & ResourceController::ACTIVE_ADMIN_ACTIONS
+ end
+
# Are admin notes turned on for this resource
def admin_notes?
admin_notes.nil? ? ActiveAdmin.admin_notes : admin_notes
end
@@ -153,7 +161,8 @@
end
def default_csv_builder
@default_csv_builder ||= CSVBuilder.default_for_resource(resource_class)
end
+
end # class Resource
end # module ActiveAdmin