From 4a720a2cdefc1926e0bfa23b8febd71869093c59 Mon Sep 17 00:00:00 2001 From: Arthur Neves Date: Thu, 19 Dec 2013 16:51:28 -0500 Subject: 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. --- .../lib/active_record/connection_adapters/abstract/quoting.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') 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 -- cgit v1.2.3