form_with non-associated model on another model's view

3 views
Skip to first unread message

fugee ohu

unread,
Mar 9, 2020, 10:20:58 PM3/9/20
to Ruby on Rails: Talk
In my :tour show view I put a form for :press_release and so when the form's submitted there's no prepending of press_release: { to the params hash The form doesn't have any inputs rather field values are passed in parentheses to the route I tried to prepend by adding press_release: { as shown below but it causes a syntax error
    <%= form_with model: @press_release, create_user_tour_press_release_path(press_release: {tour.id: @tour.id, artist_id: @artist.id, poster_type: 'User'}) do |f| %>
I originally had it like this:
    <%= form_with model: @press_release, create_user_tour_press_release_path(tour.id: @tour.id, artist_id: @artist.id, poster_type: 'User') do |f| %>
but that had the problem of no prepended press_release to the params

Reply all
Reply to author
Forward
0 new messages