Shrikanth Hathwar
Shrikanth Hathwar

Reputation: 1160

Adding collection_action method to the top menu item in active admin in ruby on rails

I am using active admin gem in my project for admin section.

I have written a custom method using

collection_action :method_name do

//code goes here

end

Now I would like to add this method name to the menu item. How can I do that?

Please let me know how to do it?

Upvotes: 2

Views: 281

Answers (1)

Raphael Pr
Raphael Pr

Reputation: 954

The collection_action will create the route and the action corresponding. If you need to be make this action available in your menu items you'll have to had the following lines

action_item only: :index do
  link_to 'Name the button', action: 'method_name'
end

Upvotes: 1

Related Questions