Jérémy Pouyet
Jérémy Pouyet

Reputation: 2019

ActiveAdmin show, edit, and delete actions in custom models

I have a rails 3 application which uses the ActiveAdmin gem.

If I do not customizes my models, 3 actions are enabled in each line of my model : show, edit, delete

But if I customizes my model, the actions disappear.

Model not customized showing the actions (users.rb) :

ActiveAdmin.register User, as: 'Users_full' do
  menu :parent => 'Users'
end

Custom model not showing actions (companies.rb) :

ActiveAdmin.register Company do
  index do
    selectable_column
    column :name
    column :url
  end

  csv do
    column :name
    column :url
  end
end

Is there a way to get actions in customized models ? I have already tried to add : actions :all, config.batch_actions = true and action_item to my companies.rb file but nothing change.

Upvotes: 1

Views: 2295

Answers (1)

Oleg Haidul
Oleg Haidul

Reputation: 3732

Add the actions, like:

index do
  selectable_column
  column :name
  column :url
  actions
end

You're defining the index page's content, and that content includes the actions-if you omit them, they won't show up.

Upvotes: 4

Related Questions