Try to update model using rake task
MuhammadRazaAslam opened this issue · comments
I am update model from rake task.But i try to run rake rake task, it throws an exception and not updating record.
Here is my model file.
class Product < ActiveRecord::Base
include PublicActivity::Model
tracked owner: Proc.new{ |controller, model| controller.current_user }
end
Error Message: NoMethodError: undefined method `current_user' for nil:NilClass
Let me know how i can update product record using rake task.
Whats the solution to this problem then?
What if i am updating a model using APIs?
The only solution is to skip tracking in rake tasks. https://github.com/chaps-io/public_activity/wiki/%5BHow-to%5D-Disable-tracking-for-a-class-or-globally