Quick update question

Hi there,

I’m trying to take a few variables and update an entry in a database,
and I don’t know the best way to do it. Here’s what I’ve been trying in
my controller:

var1 = whatever
var2 = whatever
guess = Guess.find(params[:id])
guess.update_attributes(:col_1 => var1, :col_2 => var2)

Can I use .update_attributes in that way? Is there a better way to do
this? Thanks in advance for helping a newbie.

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