ActiveAdmin actions

muichkine picture muichkine · Sep 8, 2014 · Viewed 16.3k times · Source

is there a way to specify in ActiveAdmin's index page of a model what actions are allowed, things like:

index do
  actions :edit
end

index do
  actions only: :edit
end

do not work. What's the correct syntax?

Appreciated.

bundle show activeadmin
/home/muichkine/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-9cfc45330e5a

Answer

Andrey Deineko picture Andrey Deineko · Sep 8, 2014

Add whatever actions you want to be available by using actions (it is usually put under model definition):

ActiveAdmin.register YourModel do
actions :index, :show, :create, :edit, :update

If you want to specify the method for certain action, you can do

action_item only: :show  do
  link_to 'Edit', action: :edit # so link will only be available on show action
end