简体   繁体   中英

how to add an association between has_many through models in a form?

I have Groups and PhoneNumbers models connected with a has_many through relationship called group_phone_numbers.

Basically, on a group edit view, I want a list of phone_numbers with add or remove links next to them. When someone clicks add, it creates an association between the models and when someone clicks remove, it removes it. Is the proper way to do this by using a form? Or should I just do a link_to a custom controller action?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM