title: disable public_activity tracking for sidekiq jobs that require current_user
body: <p>In short I get an error that <code>public_activity</code> is looking for the <code>current_user</code> while updating a model during a <code>sidekiq</code> job. That is expected since there is no <code>current_user</code>....  how do I disable <code>public_activity</code> tracking while the job is running? I've tried change <code>PublicActivity.enabled = false</code> and <code>Prospect.public_activity_off</code> during the job, but the <code>tracked owner: Proc.new{ |controller, model| controller.current_user }</code> still seems to be picking it up and looking for the <code>current_user</code></p>
  
  <p>How can I have the <code>sidekiq</code> (or any job) make updates without <code>public_activity</code> interfering ?</p>
  
  <p>Would it be better to have <code>sidekiq</code> set the <code>current_user</code> to a dummy user during the job? I don't think this would be a good idea, because then we would need to filter that out later. </p>
  
  <p>Error:</p>
  
  <pre><code>2016-04-20T17:24:53.728Z 20447 TID-owpsaw07w ProspectDataAggregationWorker JID-bad79ab6a073d57d7388e931 INFO: start
  2016-04-20T17:24:53.739Z 20447 TID-owpsaw07w ProspectDataAggregationWorker JID-bad79ab6a073d57d7388e931 INFO: fail: 0.01 sec
  2016-04-20T17:24:53.739Z 20447 TID-owpsaw07w WARN: {"class"=&gt;"ProspectDataAggregationWorker", "args"=&gt;[1], "retry"=&gt;false, "queue"=&gt;"default", "jid"=&gt;"bad79ab6a073d57d7388e931", "created_at"=&gt;1461173093.728181, "enqueued_at"=&gt;1461173093.7282372}
  2016-04-20T17:24:53.739Z 20447 TID-owpsaw07w WARN: NoMethodError: undefined method `current_user' for nil:NilClass
  2016-04-20T17:24:53.739Z 20447 TID-owpsaw07w WARN: /Users/cj/RubymineProjects/revenue_management_system/app/models/prospect.rb:3:in `block in &lt;class:Prospect&gt;'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/public_activity-1.5.0/lib/public_activity/common.rb:14:in `resolve_value'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/public_activity-1.5.0/lib/public_activity/common.rb:315:in `prepare_relation'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/public_activity-1.5.0/lib/public_activity/common.rb:281:in `prepare_settings'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/public_activity-1.5.0/lib/public_activity/common.rb:250:in `create_activity'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/public_activity-1.5.0/lib/public_activity/actions/update.rb:14:in `activity_on_update'
  /Users/cj/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
  </code></pre>
  
  <p>Full error: <a href="https://gist.github.com/cdesch/190c46c69213a37e4162e50727531761" rel="nofollow">https://gist.github.com/cdesch/190c46c69213a37e4162e50727531761</a></p>
  
  <p>Model:</p>
  
  <pre><code>class Prospect &lt; ActiveRecord::Base
    include PublicActivity::Model
    tracked owner: Proc.new{ |controller, model| controller.current_user }
        ...
      end
  </code></pre>
  
  <p>Sidekiq Job/worker</p>
  
  <pre><code>class ProspectDataAggregationWorker
    include Sidekiq::Worker
  
    sidekiq_options :retry =&gt; false # job will be discarded immediately if failed
  
    def perform(account_id)
      #Prospect.public_activity_off
      PublicActivity.enabled = false
  
      account = Account.where(id: account_id).first
      prospects = account.prospects
  
      prospects.each do |prospect|
        prospect.update_based_on_primary_assessment!
      end
      PublicActivity.enabled = true
  
      #Prospect.public_activity_on
    end
  end
  </code></pre>
  
  <p>I have also posted this same question in the <a href="https://github.com/chaps-io/public_activity/issues/259" rel="nofollow">public_activity issues</a></p>