Permalink
Browse files

less lenient on check on activesupport

  • Loading branch information...
1 parent 7b10164 commit e516e668baddecfd794c620038275f3e60dcc56d @mkristian committed Apr 6, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/ixtlan/optimistic/stale_check.rb
@@ -25,21 +25,21 @@ 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

0 comments on commit e516e66

Please sign in to comment.