a Rails application has a sanitizing method
def mobile=(value)
super(value.to_s.gsub(/\s+/, "").to_i) unless value.nil?
end
Yet, when submitting via console the following
User.last.update(mobile: nil)
the record was obviously processed to_i returning a 0
mobile: 0
implying that the syntax unless value.nil? is inappropriate. How should the method be expressed to no fire when the value submitted is nil ?
User.last.mobilebefore the update? And do you have any database defaults set for the column?