lib/ixtlan/optimistic/stale_check.rb in ixtlan-optimistic-0.2.2 vs lib/ixtlan/optimistic/stale_check.rb in ixtlan-optimistic-0.2.3
- old
+ new
@@ -23,24 +23,24 @@
module Optimistic
module StaleCheck
def __check( updated_at )
unless updated_at
- raise ObjectStaleException.new "no 'updated_at' given. could not find #{signature(*args)}."
+ raise ObjectStaleException.new "no 'updated_at' given for #{self}."
end
end
def __check_stale( updated_at, result )
if updated_at.is_a? String
updated_at = DateTime.parse( updated_at.sub(/[.][0-9]+/, '') )
end
- if defined?( ActiveSupport ) && updated_at.is_a?( ActiveSupport::TimeWithZone )
+ if defined?( ActiveSupport::TimeWithZone ) && updated_at.is_a?( ActiveSupport::TimeWithZone )
updated_at = updated_at.to_datetime
end
updated_at = updated_at.new_offset(0)
if updated_at != result.updated_at && updated_at.strftime("%Y:%m:%d %H:%M:%S") != result.updated_at.strftime("%Y:%m:%d %H:%M:%S")
- raise ObjectStaleException.new "#{result.inspect} is stale for updated at #{updated_at}."
+ raise ObjectStaleException.new "#{result.inspect} is newer than the given updated at #{updated_at}."
end
result
end
end
end