Question

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
Was it helpful?

Solution

"Once in add specified fields mode, you can exclude some specific fields with exclude_fields & exclude_fields_if:"

https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL#configuring-fields

example:

rails_admin do
 list do
   field :default
 end

   exclude_fields :created_at
end

OTHER TIPS

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. ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top