Created
July 8, 2011 03:10
-
-
Save lucascaton/1071046 to your computer and use it in GitHub Desktop.
resque.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'resque/tasks' | |
require 'active_record' | |
env = ENV["RAILS_ENV"] || 'development' | |
database_config = YAML::load(File.open('config/database.yml')) | |
connection = ActiveRecord::Base.establish_connection(database_config[env]) | |
files = ['lib/foo', 'lib/bar', 'app/models/foo', 'app/workers/foo'] | |
files.each { |file| require file } | |
task 'resque:setup' |
Nossa cara, muito bom saber disso.. valeus ai vini e lucas o/
Agradeça ao Baggio :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Boa Baggio! Testei aqui e funcionou.
Tentei usar o RAILS_ENV diretamente, mas como não carrega o environment completo do Rails, isso não funcionava, mas o ENV que você passou funcionou. Não sabia dessa, valeu :-)