Reputation: 609
I'm trying to hide a column based on their value using Active Admin.
So if id.field is null i don't want to show this column.
Index do
column :name do |value|
link_to value.id_field, name_path(value)
end
end
Upvotes: 1
Views: 2122
Reputation: 11421
There might be records that have this value, so you can't really hide the whole column base on one record (I hope it makes sense for you the way I explaind it). However you can hide the value from that cell:
Index do
column :name do |value|
link_to value.id_field, name_path(value) if value.id_field.present?
end
end
or use active_admin's status_tag
:
Index do
column :name do |value|
value.id_field.present? ? link_to(value.id_field, name_path(value)) : status_tag( "no link" )
end
end
Upvotes: 2