From 321b4c8527505f84a59412d078cef2b145782345 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 3 Feb 2012 11:36:56 -0800 Subject: pg supports real booleans, so handle the case when `true` is returned --- activerecord/lib/active_record/attribute_methods/query.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/attribute_methods/query.rb b/activerecord/lib/active_record/attribute_methods/query.rb index 948809c65a..1e841dc8e0 100644 --- a/activerecord/lib/active_record/attribute_methods/query.rb +++ b/activerecord/lib/active_record/attribute_methods/query.rb @@ -10,8 +10,11 @@ module ActiveRecord end def query_attribute(attr_name) - unless value = read_attribute(attr_name) - false + value = read_attribute(attr_name) + + case value + when true then true + when false, nil then false else column = self.class.columns_hash[attr_name] if column.nil? -- cgit v1.2.3