Flowdock
method

cast_value

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: Boolean
cast_value(value) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/type/boolean.rb, line 10
      def cast_value(value)
        if value == ''
          nil
        elsif ConnectionAdapters::Column::TRUE_VALUES.include?(value)
          true
        else
          if !ConnectionAdapters::Column::FALSE_VALUES.include?(value)
            ActiveSupport::Deprecation.warn(              You attempted to assign a value which is not explicitly `true` or `false`              (#{value.inspect})              to a boolean column. Currently this value casts to `false`. This will              change to match Ruby's semantics, and will cast to `true` in Rails 5.              If you would like to maintain the current behavior, you should              explicitly handle the values you would like cast to `false`..squish)
          end
          false
        end
      end
Register or log in to add new notes.