Module: Virtus::Attribute::NullifyBlank
- Defined in:
- lib/virtus/attribute/nullify_blank.rb
Overview
Attribute extension which nullifies blank attributes when coercion failed
Instance Method Summary collapse
Instance Method Details
#coerce(input) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/virtus/attribute/nullify_blank.rb', line 11 def coerce(input) output = super if !value_coerced?(output) && input.to_s.empty? nil else output end end |