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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.