title: Scheduler Job not running in Rails 4
body: <p>I have a rails app where an order is assigned to a vendor and the vendor has to accept the order within the next 15 minutes (for test purpose, I am keeping it to two minutes).Once the order is assigned to a vendor, status attribute in the order-assignment table for orders and vendors is updated to assigned. Now the vendor has to accept or reject the order based on which the status is updated to accepted and rejected respectively. If the vendor does not accepts/rejects the order in the next 15 minutes from the time of assignment, the status is automatically updated to rejected in the order-assignment table. Here are the snippets</p>
  
  <p>OrderAssignment model:</p>
  
  <pre><code>class Estamps::OrderAssignment &lt; ActiveRecord::Base
  belongs_to :vendor, class_name: 'Estamps::Vendor'
  belongs_to :order, class_name: 'Estamps::Order'
  belongs_to :status, class_name: 'Estamps::OrderAssignments::Status'
  
  
  after_save :enqueue_check_status 
  
  def enqueue_check_status 
     AutoRejectionJob.set(wait: 2.minutes).perform_later(self.id)
     if self.status_id == 3
      OnRejectionJob.perform_later(self.id)
     end
  end
  
  end
  </code></pre>
  
  <p>Order model:</p>
  
  <pre><code>has_many :order_assignments
  belongs_to :vendor
  </code></pre>
  
  <p>Vendor Model:</p>
  
  <pre><code>has_many :order_assignments
  has_many :orders
  </code></pre>
  
  <p>Auto_rejection_job</p>
  
  <pre><code>class AutoRejectionJob &lt; ActiveJob::Base
  queue_as :auto_rejection
  
  def perform(order_assignment_id)
      order_assignment = Estamps::OrderAssignment.find(order_assignment_id) 
      if order_assignment 
           if order_assignment.status_id == 1 
               order_assignment.update_attribute('status_id', '3')
               order_assignment.save!
           end  
      end
  end
  end         
  </code></pre>
  
  <p>OrderAssignment schema:</p>
  
  <pre><code> create_table "estamps_order_assignments", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer  "vendor_id"
    t.integer  "order_id"
    t.integer  "status_id"
   end
  </code></pre>
  
  <p>Here the status_id comes from another table which contains various statuses.</p>
  
  <p>Now after creation of an order assignment record, where the status is initially assigned(status_id: 1), if the vendor does not updates the status, then the status_id is automatically updated to status_id:3(rejected). This I tried achieving in the auto_rejection_job. But although, the job is showed as enqued, the status_id is not updated. The job did run correctly when I ran it on console as </p>
  
  <pre><code>AutoRejectionJob.set(wait: 2.minutes).**perform_now**(an id), 
  </code></pre>
  
  <p>then the status_id is updated, but does not work for the specified scheduled time.Where am I going wrong? HOw can I achieve this? Newbie to rails, so please help.</p>