-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating has_many relations in multiple select field #34
Comments
Here is some sample code required to collection_select or collection_check_boxes work: collection_select :author_ids, User.all, :id, :name, { label: "Author(s)" }, { multiple: true } or collection_check_boxes :author_ids, User.all, :id, :name, { label: "Author(s)" } There might be a couple of things that are tripping you up: a) Make sure you use the |
Closing. Feel free to re-open if it hasn't solved your issue. |
Hi sorry for the delay, i just tried it but i'm getting a "undefined method `services_ids' for #<Hotel" (that field is has_many relation to another model) . And when i remove the suffix, i get the multiple checkboxs showing correctly in the form, but when i post i get " #<ActiveRecord::AssociationTypeMismatch: Service(#70191805563060) expected, got String(#70191807635240)>". Any idea what am i doing wrong? |
Try with Without the |
Hi! I wanted to know if it's posible to add, to the edit form, a multiple select field for a has_many relationship. I tried with collection_check_boxes and it shows all the checkboxes, but it won't save. Also tried with collection_select and services, but it's not a multiple select and i won't save either.
Love the admin! I hope this is possible
Thanks!
The text was updated successfully, but these errors were encountered: