aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-30 14:25:29 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-30 14:25:29 +0000
commitcfef86c6454482993872557eb57b2a37e0fefdd5 (patch)
tree5a806335e3137605b5c25f8f1e61e7b1e451c71e
parentea3016f5d93706a497fb5887e72e7c9ac5d8e9d9 (diff)
downloadrails-cfef86c6454482993872557eb57b2a37e0fefdd5.tar.gz
rails-cfef86c6454482993872557eb57b2a37e0fefdd5.tar.bz2
rails-cfef86c6454482993872557eb57b2a37e0fefdd5.zip
Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1039 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 4c0c11e4a9..342fa55d89 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas]
+
* Renamed DateHelper#distance_of_time_in_words_to_now to DateHelper#time_ago_in_words (old method name is still available as a deprecated alias)
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f5a531c8ba..bba321dd9b 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1085,7 +1085,7 @@ module ActiveRecord #:nodoc:
# Delegates to id in order to allow two records of the same type and id to work with something like:
# [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
def hash
- id
+ id.hash
end
# For checking respond_to? without searching the attributes (which is faster).