I have a nested form categories
for stores
resource. They have a has_and_belongs_to_many relationship.
When I create the nested form, I get the following on the stores form:
But what I really want is a checklist like this:
Any ideas?
I have a nested form categories
for stores
resource. They have a has_and_belongs_to_many relationship.
When I create the nested form, I get the following on the stores form:
But what I really want is a checklist like this:
Any ideas?
Turns out that after creating those relationships between the models, I don't need to do the f.has_many
loop in the activeadmin resource. Instead, I just needed the following to make it work:
f.input :categories, :as => :check_boxes
This will automatically take the categories and check the default ones (and also handle any changes made to it).
permit_params category_ids: []
in ActiveAdmin resource.
– Umesh
Aug 9 '14 at 7:28