Skip to content

Instantly share code, notes, and snippets.

@garrow
Created April 18, 2012 02:45
Show Gist options
  • Save garrow/2410742 to your computer and use it in GitHub Desktop.
Save garrow/2410742 to your computer and use it in GitHub Desktop.
ActiveAdmin::Register Package do
# A custom action we want treated like the :show or :edit actions.
member_action :overview, :method => :get do
@package = Package.find params[:id]
end
# Add the actions for the :overview action.
template_actions_for :overview, :show
end
class ActiveAdmin::DSL
def template_actions_for action, template_action
config.template_actions_for action, template_action
end
end
module ActiveAdmin
class Resource
module ActionItems
def template_actions_for action, template_action
action_items_for(template_action).each do |action_item|
add_action_item :only => [action], &action_item.block
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment