Search code examples
ruby-on-rails-2

How to create a link that will update a column


I'm using Rails 2.3.8.

How do you create a link that will update a column?

So, I'm trying <%= link_to 'stuff', :controller => controller, :action => action, :id => id %>

The action method will just update the column of the row associated with :id, so I don't want it to redirect to controller/action page. I just want the column updated and call save on the object.


Solution

  • Never use a GET to update anything, always use a POST. Meaning: A link is bad practice and a security risk.