activerecord-postgres-hstore
activerecord-postgres-hstore copied to clipboard
Deserialization issue
This is Rails 3.2.
I'm getting the following error, but only when the method is executed via Sidekiq:
2014-08-14T15:14:25.255Z 23335 TID-ovtw9n32c WARN: undefined method `scan' for {}:Hash
2014-08-14T15:14:25.255Z 23335 TID-ovtw9n32c WARN: /Users/me/myapp/code/myfitment/.gems/ruby/1.9.1/gems/pg-hstore-1.2.0/lib/pg_hstore.rb:24:in `load`
It's triggered two ways:
- By referencing the HStore field on the model instance
- By calling "save" on the model instance
The error does not occur in the console. This tells me it is some kind of deserialization issue coming from Sidekiq. I can't decide whether Sidekiq is doing the serialization of the HStore field wrong, or if activerecord-postgres-hstore is doing the deserialization wrong.
The workaround is to call "self.reload" in the model instance method that is executed via Sidekiq's "delay" method.
Looks like this was cross-posted and answered on https://github.com/mperham/sidekiq/issues/1899