class Car < ActiveRecord::Base
store :options, accessors: [:bla, :blaa, :blaaa]
end
In the console:
Car.create(name: "aventador")
car = Car.last
=> #<Item id: 5839, name: "aventador">
car.options_changed?
=> false
car.save
(0.3ms) UPDATE "cars" SET "updated_at" = '2013-03-27 15:26:05.435320', "options" = '--- {}'
Nothing changed, the store wasn't accessed. Why is it re-serializing the options store every time the record is saved?
This is actually a feature: https://github.com/rails/rails/issues/8328
It's done this way because there is a way to change the data within these stores without marking them as dirty. For this reason, they chose to always re-serialize them. It might change in the future.