Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ActiveRecord::StatementInvalid (Could not find table 'delayed_jobs') #12

Closed
ghost opened this Issue Feb 8, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Feb 8, 2012

Hey guys,

When some application set AR configurations below:

active_record.table_name_prefix = "my_app_"
active_record.table_name_suffix = ""

and run migrations, AR creates a table with name "my_app_delayed_jobs"

Then DJ AR Backend try to query with name "delayed_jobs" and you get the Error:
ActiveRecord::StatementInvalid (Could not find table 'delayed_jobs'):
or
ActiveRecord::JdbcError (query does not return ResultSet):
If application using activerecord-jdbc-adapter

Is it possible to set DJ table name with AR prefix and suffix configs?
something like this:

self.table_name = "#{::ActiveRecord::Base.table_name_prefix}delayed_jobs#{::ActiveRecord::Base.table_name_suffix}"

Using

  • delayed_job (3.0.1)
  • delayed_job_active_record (0.3.2)
  • rails (3.1.3)
  • activerecord (3.1.3)
@ghost

ghost commented Feb 13, 2012

For Rails applications an alternative fix is set DJ table name on application.rb like:
Delayed::Backend::ActiveRecord::Job.table_name = "my_app_#{Delayed::Backend::ActiveRecord::Job.table_name}"

@albus522 albus522 closed this Sep 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment