# Quick update question

**URL:** <https://www.ruby-forum.com/t/quick-update-question/124420>\
**Category:** Rails\
**Created:** [December 28, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/quick-update-question/124420 "2007-12-28T16:16:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [December 28, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/quick-update-question/124420/1 "2007-12-28T16:16:26Z")

</div>

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.
