Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed rails2 compatibility

  • Loading branch information...
commit 1935122ccba36d95de97fa9144f94948cd21de3f 1 parent f276ec2
@rwz rwz authored
Showing with 8 additions and 22 deletions.
  1. +8 −22 lib/delayed/backend/active_record.rb
View
30 lib/delayed/backend/active_record.rb
@@ -12,33 +12,19 @@ class Job < ::ActiveRecord::Base
before_save :set_default_run_at
- def self.rails3?
- ::ActiveRecord::VERSION::MAJOR == 3
- end
-
def self.set_delayed_job_table_name
delayed_job_table_name = "#{::ActiveRecord::Base.table_name_prefix}delayed_jobs"
-
- if rails3?
- self.table_name = delayed_job_table_name
- else
- set_table_name delayed_job_table_name
- end
+ self.table_name = delayed_job_table_name
end
+
self.set_delayed_job_table_name
- if rails3?
- def self.ready_to_run(worker_name, max_run_time)
- where('(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name)
- end
- def self.by_priority
- order('priority ASC, run_at ASC')
- end
- else
- named_scope :ready_to_run, lambda {|worker_name, max_run_time|
- { :conditions => ['(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name] }
- }
- named_scope :by_priority, :order => 'priority ASC, run_at ASC'
+ def self.ready_to_run(worker_name, max_run_time)
+ where('(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name)
+ end
+
+ def self.by_priority
+ order('priority ASC, run_at ASC')
end
def self.before_fork
Please sign in to comment.
Something went wrong with that request. Please try again.