Updating only some of the fields of a table


It’s not clear to me how to save data to only some of the fields of a
table. To update individual fields I can do something like this:

@foo = Foo.new
@foo.bar = “hello!”
@foo.anotherbar = “hello again”

However what if I only want to save the field “anotherbar” and don’t
want the final insert or save query to contain the field “bar” at all?
If I do somethig like this…

@foo = Foo.new
@foo.anotherbar = “hello again”

…as expected, rails still tries to create an INSERT query with the
“bar” record, giving it a NULL value. Any idea how I could ommit the
“other” field completely?


Never mind. I was doing something completely wrong. It seems to work
fine as is.