Fixed that AR exists?() would explode on postgresql if the passed id did not...

Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@983 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 f30b7a31
*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]
......
......@@ -330,7 +330,7 @@ def find(*args)
# 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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册