Update vehicle.rb

This commit is contained in:
2017-06-06 08:25:35 -04:00
committed by GitHub
parent 3ba5337812
commit 56793cee7c

View File

@@ -72,7 +72,7 @@ class Vehicle < ActiveRecord::Base
# Force Upper Case for VIN numbers # Force Upper Case for VIN numbers
def vin=(val) def vin=(val)
# The to_s is in case you get nil/non-string # The to_s is in case you get nil/non-string
write_attribute(:vin, val.to_s.gsub(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase) write_attribute(:vin, val.to_s.gsub!(/[^ABCDEFGHJKLMNPRSTUVWXYZabcdefghjklmnprstuvwxyz0123456789]/, '').join.upcase)
end end
# search for a vin # search for a vin