Permalink
Browse files

fix for #first and #last object being destroyed?

  • Loading branch information...
snovotny committed Apr 27, 2012
1 parent 2c0c98f commit 070d10dc8b59e9f43dc0c576c9288ecdfffece80
Showing with 4 additions and 0 deletions.
  1. +1 −0 lib/dm-redis-adapter/adapter.rb
  2. +3 −0 spec/dm_redis_validations_spec.rb
@@ -155,6 +155,7 @@ def records_for(query)
if query.conditions.nil?
@redis.smembers(key_set_for(query.model)).each do |key|
+ key = key.to_i if key =~ /^\d+$/
keys << {redis_key_for(query.model) => key}
end
else
@@ -118,6 +118,9 @@ class Blackguard
james = Blackguard.create(:nickname => "James 'cannon-fingers' Doolittle")
Blackguard.get(petey.id).should_not be_destroyed
Blackguard.first(:nickname => "James 'cannon-fingers' Doolittle").should_not be_destroyed
+ Blackguard.first.should_not be_destroyed
+ Blackguard.last.should_not be_destroyed
+ Blackguard.all.first.should_not be_destroyed
end
end

0 comments on commit 070d10d

Please sign in to comment.