Skip to content

Instantly share code, notes, and snippets.

@attenzione
attenzione / boolean_value.rb
Last active June 11, 2020 08:22
Ruby: casting to boolean value
class BooleanValue
# https://github.com/rails/rails/blob/master/activemodel/lib/active_model/type/boolean.rb
FALSE_VALUES = [
false, 0,
"0", :"0",
"f", :f,
"F", :F,
"false", :false,
"FALSE", :FALSE,
"off", :off,

There are several types of relationships.

  • OneToMany
  • OneToOne
  • OneToNone
  • ManyToNone

A OneToMany relationship has a Set of members and a link to the belongsTo. Each member and the belongsTo has a link back to the relationship. The member links can change.

A ManyToNone relationship has a Set of members and a link to the belongsTo. The belongsTo has a link back to the relationship. The link doesn't change.