I am using the Sidekiq gem in my Rails app to handle some long-running processes asynchronously. As illustrated in this Railscast, a reference to the model to be processed is passed as an argument to the perform_async method of the worker class doing the background processing.
This would not be a problem if the model in question was an Active Record object. However it is an Active Type object designed to "quack like ActiveRecord" and unfortunately it does not quack as loudly so I get an ActiveRecord::UnknownPrimaryKeyError.
How do I set a primary key for a Ruby object that really is not a db object and convince Sidekiq to treat it as such? Unable to glean information on how to do this from the Active Type Github page.
[Copied from here]
I am using the Sidekiq gem in my Rails app to handle some long-running processes asynchronously. As illustrated in this Railscast, a reference to the model to be processed is passed as an argument to the perform_async method of the worker class doing the background processing.
This would not be a problem if the model in question was an Active Record object. However it is an Active Type object designed to "quack like ActiveRecord" and unfortunately it does not quack as loudly so I get an ActiveRecord::UnknownPrimaryKeyError.
How do I set a primary key for a Ruby object that really is not a db object and convince Sidekiq to treat it as such? Unable to glean information on how to do this from the Active Type Github page.
Any help will be greatly appreciated!