lib/active_admin/resource/routes.rb in activeadmin-1.4.3 vs lib/active_admin/resource/routes.rb in activeadmin-2.0.0.rc1

- old
+ new

@@ -18,13 +18,17 @@ def route_instance_path(resource, additional_params = {}) route_builder.instance_path(resource, additional_params) end def route_edit_instance_path(resource, additional_params = {}) - route_builder.edit_instance_path(resource, additional_params) + route_builder.member_action_path(:edit, resource, additional_params) end + def route_member_action_path(action, resource, additional_params = {}) + route_builder.member_action_path(action, resource, additional_params) + end + # Returns the routes prefix for this config def route_prefix namespace.route_prefix end @@ -73,15 +77,16 @@ route_name = route_name(resource.resources_configuration[:self][:route_instance_name]) routes.public_send route_name, *route_instance_params(instance), additional_params end - # @return [String] the path to the edit page of this resource + # @return [String] the path to the member action of this resource + # @param action [Symbol] # @param instance [ActiveRecord::Base] the instance we want the path of # @example "/admin/posts/1/edit" - def edit_instance_path(instance, additional_params = {}) + def member_action_path(action, instance, additional_params = {}) path = resource.resources_configuration[:self][:route_instance_name] - route_name = route_name(path, action: :edit) + route_name = route_name(path, action: action) routes.public_send route_name, *route_instance_params(instance), additional_params end private