palkan/store_attribute

Reading store attribute with the default value populates changes

palkan opened this issue · 2 comments

Example:

class User < ActiveRecord::Base
  store_attribute :meta, :last_updated_at, :date, default: -> { Date.new } 
end

 u = User.first; nil
=> nil
» u.changes
=> {}
» u.meta['foo']
=> nil
» u.changes
=> {"meta"=>
  [{"last_updated_at"=>Thu, 10 Sep 2020},
   {"last_updated_at"=>Thu, 10 Sep 2020}]}

Just ran into this again. Are you soliciting for a fix? :)

Yeah, I would be glad to merge a PR with a fix :)