invoice_keeper/app/models/customer.rb

14 lines
430 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}
belongs_to :user
def adress
self.street + "; " + self.postcode + " " + self.city
end
end