When an inner element of the link is smaller than the containing anchor, and clicking that SVG element the nested-rondo controller uses the event.target of the SVG instead of the anchor, and the dataset.association accessors return undefined, thus the [new_photos] is never updated and the controller dismisses new records to be added.
This fix aims to traverse the element that was clicked until the one with the data-association or data-associations attributes are found and use that element for the rest of the method.
Thanks for your contribution!
I'll release a new version soon. Before I upgrade the version, you can fetch this gem from GitHub source to see your changes.
Noticed the following when using the
link_to_add_association
with a block like this:When an inner element of the link is smaller than the containing anchor, and clicking that SVG element the nested-rondo controller uses the
event.target
of the SVG instead of the anchor, and thedataset.association
accessors return undefined, thus the[new_photos]
is never updated and the controller dismisses new records to be added.This fix aims to traverse the element that was clicked until the one with the
data-association
ordata-associations
attributes are found and use that element for the rest of the method.