I have a pretty straight forward nested form.
Categories has_many awards has_many recommendations.
So my recommendation form is a partial and the form_for leads off with:
<%= form_for [@category, @award, @recommendation], :url => category_award_recommendations_path(@category, @award, @recommendation), :html => { :multipart => true} do |f| %>
this works fine and processes for the #new form. But when I mess with the #edit view it renders fine but when I submit it it uses the following url:
http://localhost:3000/categories/1/awards/1/recommendations.112
Question:
Why does it render the “.” instead of a “/”
You are using
category_award_recommendations_path, when it should becategory_award_recommendation_path(notice thesmissing at the end ofrecommendation).EDIT: This is the answer for
Your form action url should change wether it’s creating something or editing something.
form_fordoes it itself when you don’t supply the:urloption, based on wether the object is persisted or not.