Update_all for an AR instance

Is there anyway to call “update_attributes” where it updates only the
attributes you specify with the update command.

The only thing close to this is update_all where you have to specify the
condition. So essentially you’d be stuck doing “id=#{obj.id}” as the
condition.

Are there any built in AR functions that allow you to update a
particular object using straight sql UPDATE without saving all the
attributes (ie, updating only the attributes you designate.)

In any case, I extended ActiveRecord::Base to do something like this.
Here is my function:

  def update_attributes_with_sql(attributes) # allows you to update

individual columns without saving the whole record (also much faster)
update_sql = if attributes.is_a?(Hash)
attributes.to_a.collect do |key_value|
k, v = key_value
v = v.to_s(:db) if v.is_a?(Time)
v = “’#{v}’” if v.is_a?(String)
%{#{k.to_s}=#{v}}
end.join(", ")
else
attributes
end
self.class.update_all update_sql, “id=#{id}”
end

Let me know if there is already something like this is in RoR.