Link_to action going wrong

Code is from the view. If a user clicks the ‘Over’ link, i want to
update the :groep attribute of the zwemmer to ‘blatest4’. But now, all
the zwemmers :groep are changed when the page loads. How can i fix this?

The following line updates all Zwemmer whose id = to blatest4

<%= link_to 'Over' , Zwemmer.update(, :groep => "blatest4")%>

change the link to point to the update action and pass the zwemmer id,
much like along the lines of

<%= link_to 'Over', zwemmer_path(zwemmer, :zwemmer => {:groep => "blatest4"}), :method => :put %>

On Thu, Feb 10, 2011 at 8:35 PM, Kelly P. [email protected]

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at

Works perfectly, thank you very much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs