Data-toggle Does Not Work with Rails accept_nested_attributes_for

Asked 2 years ago, Updated 2 years ago, 70 views

Ruby on Rails using nested_form, cocoon, etc.
You are creating a one-to-many relationship model using accepts_nested_attributes_for.

Use link_to_add_association on the one-to-many form to
If you dynamically increase or decrease the input form of many models,
The data-toggle of many forms that were displayed from the beginning works correctly.
Data-toggle is not working for the form that was increased by clicking link_to_add_association

I think it was caused by the code being escaped, but
Are there any countermeasures in this case?
Is it difficult to use data-toggle when using link_to_add_association in the first place?

I look forward to your kind cooperation.

ruby-on-rails ruby

2022-09-30 21:18

1 Answers

If you dynamically increase or decrease the input form (I think it's ajax),
It appears that data-toggle is not loaded.

I think it is necessary to reload the data-toggle with javascript when it increases or decreases.


2022-09-30 21:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.