Nested Resources w/ Rails 5.1 form_with

Try specifying the model and url separately:

form_with(model: @activity, url: [@trip, @activity])

According the docs the the values for url are “Akin to values passed to url_for or link_to” so using an array should work.

This also works with shallow nesting since the array is compacted.

Leave a Comment