当创建新资源并且需要在资源准备好之前进行一些冗长的处理时,我如何将该处理发送到不会阻止当前请求或其他流量到我的网络应用程序的后台?
在我的模型中:
class User < 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