Skip to content

Instantly share code, notes, and snippets.

@manuelmorales
Created May 4, 2011 11:34
Show Gist options
  • Save manuelmorales/955097 to your computer and use it in GitHub Desktop.
Save manuelmorales/955097 to your computer and use it in GitHub Desktop.
How to parse true/false parameters to boolean attributes with ActiveRecord
ActiveRecord::ConnectionAdapters::Column.value_to_boolean(parameter)
@Gee-Bee
Copy link

Gee-Bee commented Mar 3, 2015

From Rails 4.2 use:

ActiveRecord::Type::Boolean.new.type_cast_from_user(parameter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment