I have a partial form that creates a post that is being rendered on it's parent model communities, however, it doesn't post the form to this path:
POST /communities/:community_id/posts(.:format) posts#create
Instead, it will try posting to the path it's rendered on. For example, No route matches [POST] "/communities/1"
because I have the form on a community page.
This is running Rails 6 beta.
I believe a solution would be to specify the path for where it sends to in the form, but I cannot find anything in the documentation that matches that. Either I'm reading wrong, or it's a nonexistent solution and requires a different approach. I'm really not sure.
posts/_form.html.erb
<%= form_with model: @post, local: true do |form| %>
...
<% end %>
routes.rb
resources :communities do
resources :posts
end