invoice_keeper/app/models/customer.rb

13 lines
411 B
Ruby

class Customer < ApplicationRecord
validates :name, presence: true, length: { minimum: 5 }
validates :street, presence: true, length: { minimum: 5 }
validates :postcode, presence: true, length: { minimum: 5 }
validates :city, presence: true, length: { minimum: 3 }
validates :nip, presence: true, length: {minimum: 13}
def adress
self.street + "; " + self.postcode + " " + self.city
end
end