I cannot force my link_to statement to send an HTTP put into my
controller’s update method. It appears to be using get and therefore
invoking the show method. Here is what my view looks like (I am using
nested resources where item :has_many :costs):
The answer to seemingly broken rails behavior is usually “duh…I
should have realized that!”
My link_to syntax was fine. The HTTP put was successfully finding the
correct controller method, but that method was performing a redirect
that was failing (in a rather opaque way to me) because in this
particular code path I did not initialize an instance variable (@item)
that was the parameter to the redirect because I was bypassing a
form_for…submit action that otherwise passes in the item.id:
redirect_to edit_item_cost_path(@item, @cost)
It appears that this RESTful helper fails with a not-too-insightful
error when passed a bogus parameter.
Thanks everyone who pitched in with suggestions and pointers.
Mark
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.