In rails_admin gem i have a model with some field. In list action is possible to view all field except one field? if i write:
rails_admin do
 list do
   field :name
 end
end
I see only this field, i need the inverse behavior. I have found no solutions
#somethis like this
rails_admin do
 list do
   field :default , except :created_at
 end
end
can you help me?
A possible workaround is list all necessary field, but is not very clean in my opinion
SOLUTION this works for me:
list do
      exclude_fields :created_at
end
                "Once in add specified fields mode, you can exclude some specific fields with exclude_fields & exclude_fields_if:"
https://github.com/railsadminteam/rails_admin/wiki/Fields#exclusion
example:
rails_admin do
 list do
   field :default
 end
   exclude_fields :created_at
end
                        This is ruby - use it!
rails_admin do
  list do
    (column_names - %w{created_at}).each do |col_name|
      field col_name.to_sym
    end
  end
end
Or you can just use the exclude_fields macro as @flylib has pointed out. ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With