Permalink
Browse files

Merge pull request #26 from rwz/master

Removed rails 2 compatibility
  • Loading branch information...
sferik committed Feb 10, 2013
2 parents 666cbc1 + 1935122 commit 5710535a1ac126e248ee7999d43878b21ac888e8
Showing with 8 additions and 22 deletions.
  1. +8 −22 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

0 comments on commit 5710535

Please sign in to comment.