Skip to content

Instantly share code, notes, and snippets.

@vmcilwain
Created June 14, 2018 14:12
Show Gist options
  • Save vmcilwain/2ecaa19bd87d3fd59ff2eb052e7d0368 to your computer and use it in GitHub Desktop.
Save vmcilwain/2ecaa19bd87d3fd59ff2eb052e7d0368 to your computer and use it in GitHub Desktop.
Rails 3 casting a string value into a boolean
ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
# Values for true:
# 1, "1", "t", "T", "true", "TRUE", true, "on", "ON"
# Values for false:
# 0, "0", "n", "N", "false", "FALSE", false, "off", "OFF"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment