Method: ActiveRecord::ConnectionAdapters::Column.value_to_boolean

Defined in:
activerecord/lib/active_record/connection_adapters/column.rb

.value_to_boolean(value) ⇒ Object

convert something to a boolean



161
162
163
164
165
166
167
# File 'activerecord/lib/active_record/connection_adapters/column.rb', line 161

def value_to_boolean(value)
  if value.is_a?(String) && value.empty?
    nil
  else
    TRUE_VALUES.include?(value)
  end
end

Comments