Question

I have a user form in my ActiveAdmin to manage a series of Booleans to partition off parts of my application based on them being true or not. This works pretty well. But two of my User boolean fields are rendered in the ActiveAdmin user edit screen as select menus instead of tick boxes.

form do |f|
  f.inputs "Admin Details" do
  ...
  f.input :super_admin, :label => "Super Administrator"
  f.input :account_manager
  f.input :sales_manager
  f.input :general_manager
  f.input :project_pipeline
  f.input :sales
  f.input :customers
  f.input :products
  f.input :price_lists
  f.input :project_action_plans
  f.input :projects

end
f.actions

end

enter image description here

I am failing to understand why this is happening. All I want is the two boolean fields (which are stored as boolean in my Postgresql database) to act as boolean fields on the page.

Any ideas would be greatly appreciated.

Était-ce utile?

La solution

I have fixed this by renaming the boolean fields to "authenticate_projects", "authenticate_project_action_plans" etc etc.

Now they are working as boolean fields and I can check them etc.

It seems that they activerecord association was somehow being applied to the field in the simple_form active_admin view so must have been trying to return the users projects or users project action plans so I would have a collection being input and so it would try and default it to the select box. Obviously without specifying which field from the collection to use as the value it was giving the dreaded # or whatever it is. And not 'dreaded' but I seem to hit this wall a lot so it dreads me.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top