Skip to content

Console new record modal

Petr Marek edited this page Jul 15, 2019 · 2 revisions

Add an "Add record" button under an association input.

= f.association :user, collection: MyProject::User.collection_for_select
= new_record_modal_toggle(MyProject::User, label: t('.add_user'))

...

/ Only use this once, it adds a modal via content_for
= new_record_modal(MyProject::User)

Once the record in modal is successfully saved, it's added as an option to all matching selects and selected in the field above the clicked toggle.