palkan/store_attribute

Dirty tracking methods erroring out when used in callback proc

NgariNdungu opened this issue · 1 comments

Tell us about your environment

Ruby Version: 3.0.0

Rails Version: 6.1.4.1

PostgreSQL Version: 13.2

Store Attribute Version: 0.9.0

What did you do?

I ran bundle update, which updated store_attribute to 0.9.0 from 0.8.1.

What did you expect to happen?

What actually happened?

After update, my test suite is failing on a model that uses store_attribute and uses dirty tracking methods in conditional callbacks;

  store_attribute :settings, :apis, :string  
  before_update :activate, if: -> { apis_changed? }

On binding and calling the method directly I get;

NoMethodError: undefined method `each' for nil:NilClass
from /home/deploy/.bundle/gems/store_attribute-0.9.0/lib/store_attribute/active_record/store.rb:74:in `block (3 levels) in store_accessor'

Thanks for the report!
Fixed and will be released soon.