module Virtus::Attribute::NullifyBlank
Attribute
extension which nullifies blank attributes when coercion failed
Public Instance Methods
coerce(input)
click to toggle source
@see [Attribute#coerce]
@api public
Calls superclass method
# File lib/virtus/attribute/nullify_blank.rb, line 11 def coerce(input) output = super if !value_coerced?(output) && input.blank? nil # Added to nullify anything that is blank not just strings. elsif output.blank? && output != false nil else output end end