title: Ruby on Rails - Delayed job in model
body: <p>I need to do a delayed job to count fbLikes in Model but I have the error report of "undefined send_later() method". Is there any way to do delayed job to my fb_likes function in model? </p>
  
  <p>==============================Latest===================================================</p>
  
  <p>This is my latest code in my project. Things still the same, fb_likes does not display likes count.</p>
  
  <p>[Company.rb]-MODEL</p>
  
  <pre><code>require "delayed_job"
  require "count_job.rb"
  
  class Company &lt; ActiveRecord::Base
  
  before_save :fb_likes
  
      def fb_likes            
          Delayed::Job.enqueue(CountJob.new(self.fbId))
      end     
   end
  </code></pre>
  
  <p>[config/lib/count_job.rb]</p>
  
  <pre><code>class CountJob&lt;Struct.new(:fbId)
  def perform 
      uri = URI("http://graph.facebook.com/#{fbId}")
      data = Net::HTTP.get(uri)
      self.fbLikes = JSON.parse(data)['likes']
  end
  end
  </code></pre>
  
  <p>[controller]</p>
  
  <pre><code> def create 
      @company = Company.new(params[:company])
  
      if @company.save!
          flash[:success] = "New company successfully registered."
     ----and other more code----
  </code></pre>