type_cast_code (ActiveRecord::ConnectionAdapters::Column)

    # File lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 82
          def type_cast_code(var_name)
            case type
              when :string    then nil
              when :text      then nil
              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})"
              when :datetime  then "#{self.class.name}.string_to_time(#{var_name})"
              when :timestamp then "#{self.class.name}.string_to_time(#{var_name})"
              when :time      then "#{self.class.name}.string_to_dummy_time(#{var_name})"
              when :date      then "#{self.class.name}.string_to_date(#{var_name})"
              when :binary    then "#{self.class.name}.binary_to_string(#{var_name})"
              when :boolean   then "#{self.class.name}.value_to_boolean(#{var_name})"
              else nil
            end
          end