I have an object title with an association song
In my index of a titles, each title has a link_to button that creates a new title that I would like associated with the same song object. So it's something like this:
link_to "Add Title", new_title_path, remote: true
In the view that has the above code I have the song_id. I can display the form that gets returned when this link is clicked, I can submit the data and create the new title but how do I get the song_id into that form or into the new title?
Add parameter to the link, assuming
songis the objectNow in the new action
and finally in the
new.html.erbform, add a hidden field tagHope this helps!