5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/ixtlan/core/active_record.rb', line 5
def self.included(base)
base.class_eval do
def self.optimistic_find(updated_at, *args)
if updated_at
updated_at_date = new(:updated_at => updated_at).updated_at
first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at, updated_at_date - 0.001]) || first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at_date, updated_at_date - 0.001])
end
end
end
end
|