title: Ruby on Rails: How to run things in the background?
body: <p>When a new resource is created and it needs to do some <strong>lengthy processing</strong> before the resource is ready, how do I send that processing away <strong>into the background</strong> where it <em>won't hold up</em> the current request or other traffic to my web-app?</p>
  
  <p>in my model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
   after_save :background_check
  
   protected
   def background_check
    # check through a list of 10000000000001 mil different
    # databases that takes approx one hour :)
    if( check_for_record_in_www( self.username ) )
      # code that is run after the 1 hour process is finished.
      user.update_attribute( :has_record )
    end
   end
  end
  </code></pre>