Reputation: 349
admin/user.rb
index row_class: ->user { 'active' if user.deleted_at? } do
selectable_column
id_column
column :email
column :name
actions
end
User.all.each do |user|
if user.deleted_at?
config.batch_actions = false
end
end
At the moment i have batch actions for all the users. However, I don't want batch action select box present for soft deleted users. I tried to loop through all the users and made batch_actions false for deleted_at users. But that doesn't seems to be working. Is it even possible?
Upvotes: 3
Views: 1072
Reputation: 128
You can use the source for selectable_column
to do it:
column resource_selection_toggle_cell, class: 'col-selectable', sortable: false do |resource|
if resource.can_be_selected?
resource_selection_cell resource
end
end
Upvotes: 3