> I think it is like silently swallowing exception without knowing what
> to do about them.
>
> I will suggest to modify the existing implementation of
> ActiveRecord::ConnectionAdapters::Column::value_to_boolean
>
> to
> ActiveRecord::ConnectionAdapters::Column.class_eval %q{
>  def self.value_to_boolean(value)
>    case value
>    when *TRUE_VALUES.to_a: true
>    when *FALSE_VALUES.to_a: false
>    else nil
>    end
>  end
> }
>
> First of all it simplifies the implementation (getting rid of initial
> if. secondly it will at least result in nil if value is neither
> recognised among TRUE_VALUES nor FALSE_VALUES

The initial if is there deliberately to allow people with html forms
to transmit a nil value by sending a blank string.  But as for the
coerce to nil suggestion
that would be similarly silent for users.  People who didn't set their
columns to NOT NULL would just start having NULL values showing up
where previously they were false.  Seems like this would replace one
slightly strange situation with another, and not necessarily improve
things




-- 
Cheers

Koz

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to