0

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.

boo-urns
  • 10,136
  • 26
  • 71
  • 107

1 Answers1

0

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

Trey Gramann
  • 2,004
  • 20
  • 23
  • You need to post more code. Do you mean an html column or a database column? Since you would update a database row, I assume you mean html. Ajax post and target the results to the element with your id. I like
    over .
    – Trey Gramann Feb 21 '13 at 02:01
  • Sorry about that! It's probably my worst-written question. I added some more details. It seems that my question should be: how to get `link_to` to accomplish a PUT? – boo-urns Feb 21 '13 at 07:30