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


On Apr 17, 2:01 am, Colin Law <clan...@googlemail.com> wrote:
> On 17 April 2010 09:29, Heinz Strunk <li...@ruby-forum.com> wrote:
>
> > Colin Law wrote:
>
> >> Have you checked the html generated by the link, and looked in the log
> >> to see if anything useful there?
>
> >> Colin
>
> > Yeah, what's the output of
> > <%= link_to 'Recalculate', item_cost_path(:recalc => 1), :method
> > => :put %>?
>
> What have you got?
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to