From 72c18189410513bbf474cb9d678b14d2e3591cc5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 28 Jan 2011 17:39:38 -0800 Subject: use an identity conversion to avoid conditional codes --- .../active_record/connection_adapters/abstract/schema_definitions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 60ccf9edf3..1a5d0c2f6d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -87,8 +87,8 @@ module ActiveRecord def type_cast_code(var_name) case type - when :string then nil - when :text then nil + when :string then var_name + when :text then var_name when :integer then "(#{var_name}.to_i rescue #{var_name} ? 1 : 0)" when :float then "#{var_name}.to_f" when :decimal then "#{self.class.name}.value_to_decimal(#{var_name})" -- cgit v1.2.3