ruby-on-rails-5.1

Nested Resources w/ Rails 5.1 form_with

别来无恙 提交于 2019-11-29 05:36:21
Per this pull request I can see that an array should be passed to form_with 's model param. However, when I supply the following: <%= form_with(model: [@trip, @activity], local: true) do |f| %> ... <% end %> Rails will return - ActionView::Template::Error (undefined method activity_path' for #<#<Class:0x007f80231e3070>:0x007f8023010dd8>): My routes file looks like: resources :trips do resources :activities end The output of rake routes looks like - trip_activities GET /trips/:trip_id/activities(.:format) activities#index POST /trips/:trip_id/activities(.:format) activities#create new_trip