Created
April 18, 2012 02:45
-
-
Save garrow/2410742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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