diff options
author | Arthur Neves <arthurnn@gmail.com> | 2013-12-19 16:51:28 -0500 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2013-12-19 16:51:28 -0500 |
commit | 4a720a2cdefc1926e0bfa23b8febd71869093c59 (patch) | |
tree | e6635d07544afff9e3fd3353003fbc562d3c6ae4 /activerecord/lib/active_record/connection_adapters | |
parent | e4cde5d58cbb09d1843796f96ba86225ff94fe05 (diff) | |
download | rails-4a720a2cdefc1926e0bfa23b8febd71869093c59.tar.gz rails-4a720a2cdefc1926e0bfa23b8febd71869093c59.tar.bz2 rails-4a720a2cdefc1926e0bfa23b8febd71869093c59.zip |
quoting: Check if id is a valid method before using it
Need to check if valud also respond_to :id before calling it, otherwise
things could explode.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index 552a22d28a..75501852ed 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -43,7 +43,9 @@ module ActiveRecord # SQLite does not understand dates, so this method will convert a Date # to a String. def type_cast(value, column) - return value.id if value.respond_to?(:quoted_id) + if value.respond_to?(:quoted_id) && value.respond_to?(:id) + return value.id + end case value when String, ActiveSupport::Multibyte::Chars |