rails/rails — Issue #4473: store :attribute always in SQL during update_attribute
Author: masterkain
Created: 2012-01-15 15:11:19+00:00
State: open

class Account < ActiveRecord::Base
store :preferences, accessors: [:hide_tooltips, :autoplay]

The following call:

account.update_attribute(:my_field, myvalue)

will produce a SQL like the following:

UPDATE `accounts` SET `updated_at` = '2012-01-15 15:09:53', `preferences` = '---\n:autoplay: false\n:hide_tooltips: false\n' `accounts`.`id` = 2

re-setting the already stored preferences even if `preferences` has not changed and therefore it's not dirty.