Rails: Link changes one attribute and then goes back

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-06-18T16:06:32Z Indexed on 2010/06/18 16:33 UTC
Read the original article Hit count: 164

Filed under:
|
|

Rails newbie here.

I have a list of items which can have a status represented by an integer (right now its just 1=active 0=inactive).

What I want is next to each item a link to change the status of that item. So it might look like this:

A nice item - Enable

Another pretty item - Disable

I can't think of how to make the link work. I just want a user to click the link and then the page refreshes and the item get updated.

This doesn't work:

<%= link_to "Enable", :controller => "items", :action => "update", :status => 1 %>

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby