Blog

Search This Blog

Loading...

Monday, January 3, 2011

Autoload Rails Models for Super Easy Rails Integration

SimpleWorker will now include all the models in your Rails app automatically so you don't have to merge them manually. Just use them almost as if they were to be run locally and you're good to go.

eg;

class MyWorker < SimpleWorker::Base
  attr_accessor :user_id
  def run
    # User model will automatically be available, so just use it as you normally would.
    user = User.find(user_id)
    .....
  end
end