aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 f782f6846d..8f3846a482 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron]
+
* Fixed the MS SQL adapter to work with the new limit/offset approach and with binary data (still suffering from 7KB limit, though) #901 [delynnb]
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 400f0ceb81..b3d4400138 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -330,7 +330,7 @@ module ActiveRecord #:nodoc:
# Example:
# Person.exists?(5)
def exists?(id)
- !find_first("#{primary_key} = #{sanitize(id)}").nil?
+ !find_first("#{primary_key} = #{sanitize(id)}").nil? rescue false
end
# This method is deprecated in favor of find with the :conditions option.