Rails: Link changes one attribute and then goes back
- by James
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 %>