Closed m3nd3s closed 12 years ago
Try requiring 'delayed_job_active_record' instead of delayed_job. That's probably what you're missing, but we need to update the README.
-DM
Daniel Morrison [i] Collective Idea http://collectiveidea.com http://ideafoundry.info 25 West 8th Street, Suite 200 Holland, MI 49423 616-990-0155 daniel@collectiveidea.com
On Dec 11, 2011, at 4:58 PM, Almir 'm3nd3s' wrote:
I follow the instructions showed on README, but, when I run
rails g delayed_job
as is showed on README the error "delayed_jobs table doesn't exists".To solve this problem I changed the method
self.guess_backend
in worker.rb as I show below:42 def self.guess_backend 43 self.backend ||= :active_record if defined?(ActiveRecord) and ActiveRecord::Base.connection.tables.include?('delayed_jobs') 44 end
Only after I added a "check code" I could continue using delayed job in my project. Someone knows why this error happen, and if this error is a bug?
My environment (using RVM): ruby 1.9.2-0136 rails 3.0.10
Reply to this email directly or view it on GitHub: https://github.com/collectiveidea/delayed_job/issues/318
README updated.
Hi @danielmorrison, thanks for help me :)
I tryed using 'delayed_job_active_record' as you sad. The delayed_job (3.0.0.pre4) and delayed_job_active_record (0.2.1) were installed, but when I runned rails g delayed_job
to generate the migration and scripts the below error happened:
/Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/base.rb:685:in `columns'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/base.rb:698:in `column_names'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/relation.rb:370:in `block in method_missing'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/relation.rb:125:in `scoping'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/relation.rb:370:in `method_missing'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/conditions.rb:92:in `condition_details'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/conditions.rb:68:in `local_condition?'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/conditions.rb:61:in `condition?'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/association_conditions.rb:6:in `condition?'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/association_ordering.rb:14:in `condition?'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/ordering.rb:11:in `condition?'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/bundler/gems/searchlogic-92487f9773b0/lib/searchlogic/named_scopes/ordering.rb:31:in `order'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activerecord-3.0.10/lib/active_record/base.rb:447:in `order'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed/backend/active_record.rb:22:in `<class:Job>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed/backend/active_record.rb:8:in `<module:ActiveRecord>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed/backend/active_record.rb:5:in `<module:Backend>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed/backend/active_record.rb:4:in `<module:Delayed>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed/backend/active_record.rb:3:in `<top (required)>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:593:in `new_constants_in'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/delayed_job_active_record-0.2.1/lib/delayed_job_active_record.rb:3:in `<top (required)>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
from /Users/m3nd3s/Projetos/adena/config/application.rb:9:in `<top (required)>'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/railties-3.0.10/lib/rails/commands.rb:15:in `require'
from /Users/m3nd3s/.rvm/gems/ruby-1.9.2-p136@adena/gems/railties-3.0.10/lib/rails/commands.rb:15:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Did you get that error while still having the guess backend method in there?
I'm sorry @bryckbost, I didn't understand what you ask. To test the way as sad by @danielmorrison first I removed the gem delayed_job: gem uninstall delayed_job
, so I add the gem instruction in Gemfile
and then I runned bundle install
. After that I runned rails g delayed_job
and I got that error.
You don't need to override the guess backend method if you've included the delayed_job_active_record gem in your Gemfile.
@bryckbost I didn't override. I added delayed_job_active_record in my Gemfile I didn't change anything in delayed_job gem. But the error, as I sad, happen
@m3nd3s I can't reproduce the issue. I'm going to close this. Feel free to open a new issue if it continues to be a problem.
I followed the instructions showed on README, but, when I run
rails g delayed_job
as is showed on README the error "delayed_jobs table doesn't exists" happens.To solve this problem I changed the method
self.guess_backend
in worker.rb as I show below:Only after I added a "check code" I could continue using delayed job in my project. Someone knows why this error happen, and if this error is a bug?
My environment (using RVM): ruby 1.9.2-0136 rails 3.0.10