Hi fantastic rails core developers.
Speaking of version 2.3.5:
I find it rather error_prone that values such that "some text" is
silently converted to false when stored in a boolean DB field.
Among other things it means that assign "some text" to boolean fields
on a model will not generate any validation messages (it will silently
be converted to false).
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
Jarl
--
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.