When dealing with creating or editing an Excursion record, there is a form that includes nested excursion_images
, which are created through a remote call using JavaScript (Fine Uploader).
While this solution works perfectly for editing an Excursion, it encounters issues when creating a new one due to the absence of an id
for the parent element.
To address this issue, an approach involves:
- Allowing the excursion_image to be created without an associated excursion.
- Adding a hidden field with an "image_code" in the _new form.
- When creating an excursion_image within the form, saving the corresponding "image_code" as an attribute.
- Upon saving the excursion, identifying all excursion_images with the matching "image_code".
While this solution may work, it doesn't seem very efficient. Are there any other alternatives available?