Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
escape column names using method provided by activerecord
Browse files Browse the repository at this point in the history
  • Loading branch information
adam12 authored and Jeff Kreeftmeijer committed Jul 9, 2010
1 parent a31fdeb commit 8bdd0b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/navvy/job/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def self.enqueue(object, method_name, *args)

def self.next(limit = self.limit)
all(
:conditions => [
'`failed_at` IS NULL AND `completed_at` IS NULL AND `run_at` <= ?',
:conditions => [
"#{connection.quote_column_name('failed_at')} IS NULL AND #{connection.quote_column_name('completed_at')} IS NULL AND #{connection.quote_column_name('run_at')} <= ?",
Time.now
],
:limit => limit,
Expand All @@ -62,12 +62,12 @@ def self.next(limit = self.limit)
def self.cleanup
if keep.is_a? Fixnum
delete_all([
'`completed_at` <= ?',
"#{connection.quote_column_name('completed_at')} <= ?",
keep.ago
])
else
delete_all(
'`completed_at` IS NOT NULL'
"#{connection.quote_column_name('completed_at')} IS NOT NULL"
) unless keep?
end
end
Expand Down Expand Up @@ -127,7 +127,7 @@ def failed(message = nil)
def times_failed
i = parent_id || id
self.class.count(
:conditions => "(`id` = '#{i}' OR `parent_id` = '#{i}') AND `failed_at` IS NOT NULL"
:conditions => "(#{connection.quote_column_name('id')} = '#{i}' OR #{connection.quote_column_name('parent_id')} = '#{i}') AND #{connection.quote_column_name('failed_at')} IS NOT NULL"
)
end
end
Expand Down

0 comments on commit 8bdd0b6

Please sign in to comment.