Skip to content
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

Update _address_field.html.erb fixes #809 #810

Merged
merged 1 commit into from Apr 5, 2024
Merged

Conversation

adampal
Copy link
Contributor

@adampal adampal commented Apr 5, 2024

Ensure dependent field updates on address are contained to the correct turbo frame.

Currently we're using the parent form to set the selector on the dependent fields. This is an issue if we want multiple address fields on the one model. This changes the selector to use the address_form so it's scoped down to just the individual address in question. With this change the javascript all does the right thing when changing countries on different addresses within the same form.

While this change doesn't immediately make it possible to add multiple address it seems like good hygiene to keep things appropriately scoped. And it's fairly trivial to add an address_type column to the Address model in applications that require multiple addresses on the same model.

Ensure dependent field updates on address are contained to the correct turbo frame
Copy link
Member

@pascallaliberte pascallaliberte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍

@jagthedrummer jagthedrummer merged commit 509ad50 into main Apr 5, 2024
30 checks passed
@jagthedrummer jagthedrummer deleted the adampal-patch-2 branch April 5, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants