This gist was writen in 2012 and it was solving specific problem in Rails & SimpleForm. Some fellow developers were pointing out this may be out dated concept. That's why I advise everyone to read comment section bellow to have a full grasp of alternative solutions
other sources that may be helpful to understand why this may not be best idea:

ok from Rails 4.2
ActiveRecord::ConnectionAdapters::Column.value_to_boolean("true")is depricated, use:Works the same way, one different is that
type_cast_form_databasereturnsnilwhenvalue = nil.One other thing I've noticed is that if the value is
yornI'm getting:... so use only strings
"true"and"false"in your radio buttons / check boxes