Rails Sidekiq ERROR: can't find object
<p>I have several sidekiq workers in my rails 4 app and can't figure out why the processes are failing. I am passing the User_id to the worker as a string but it can't seem to find the user. But when I search the same id in my console it finds the user. What am i doing wrong? Here is my code.</p>

<p>Controller.rb</p>

<pre><code>  def update
   @user = current_user
    if @user.bill.update_attributes(bill_params)
      RandomWorker.perform_async(@user.id.to_s)
      redirect_to users_dashboard_path, :notice =&gt; "Payment Informaton Updated"
    else
      ...  
    end
  end
</code></pre>

<p>Randomworker.rb</p>

<pre><code>  def perform(user_id)
    user_id = user_id["$oid"] unless user_id.is_a?(String)
    user = User.find(user_id)
    user.process.update_report 
    user.process.save
  end
</code></pre>

<p>My error comes back as</p>

<pre><code>RandomWorker  "575a..." Mongoid::Errors::DocumentNotFound: message: Document(s) not found for class User with id(s) 575a.... summary: When calling User.find with an id or array of ids, each parameter...
</code></pre>

<p>--EDIT--</p>

<p>My db config file is as shown:</p>

<pre><code>development:
 adapter: sqlite3
 database: db/development.sqlite3
 pool: 5
 timeout: 5000

production:
 adapter: sqlite3
 database: db/production.sqlite3
 pool: 25
 timeout: 5000
</code></pre>

<p>And my mongoid.yml </p>

<pre><code>development:
   # Configure available database clients. (required)
     clients:
   # Defines the default client. (required)
       default:
   # Defines the name of the default database that Mongoid can connect to.
   # (required).
         database: development_db
   # Provides the hosts the default client can connect to. Must be an array
   # of host:port pairs. (required)
         hosts:
            - localhost:27017
         options:
</code></pre>