Module: ActiveRecordOptionShim

Defined in:
lib/errgonomic/rails/active_record_optional.rb

Instance Method Summary collapse

Instance Method Details

#type_cast(value) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/errgonomic/rails/active_record_optional.rb', line 67

def type_cast(value)
  case value
  when Errgonomic::Option::Some
    super(value.unwrap!)
  when Errgonomic::Option::None
    super(nil)
  else
    super
  end
end