Update vehicle.rb

This commit is contained in:
2016-05-09 05:01:41 -04:00
parent 8e6c5f81a1
commit 20d3d61d1d

View File

@@ -12,16 +12,15 @@ class Vehicle < ActiveRecord::Base
unloadable
belongs_to :customer
attr_accessible :year, :make, :model, :customer_id, :notes, :vin
validates_presence_of :customer_id
attr_accessible :year, :make, :model, :customer, :notes, :vin
validates_presence_of :customer
validates :vin, uniqueness: true
before_save :decode_vin
after_initialize :get_details
# returns a human readable string
def to_s
return "#{self.year} #{self.make} #{self.model}"
return "#{self.customer.name} - #{self.year} #{self.make} #{self.model}"
end
# returns the raw JSON details from EMUNDS