Sha256: d875fc1d835f23475d3f2df008a9f0c17bebfa589c2fb926b9b36154622da2a6
Contents?: true
Size: 1.52 KB
Versions: 8
Compression:
Stored size: 1.52 KB
Contents
# == Schema Information # # Table name: addresses # # id :integer not null, primary key # door_no :string(10) # adr_1 :string(50) # adr_2 :string(50) # postal_code :string(7) # province :string(3) # country :string(20) # customer_id :integer # created_at :datetime # updated_at :datetime # address_type :string(20) # city :string(45) # assigned_route :string(20) # long :string(255) # lat :string(255) # status :string(20) # apt :string(255) # module CgAppBase class Address < ActiveRecord::Base include AttributesNormalizer has_paper_trail validates :adr_1, presence: true, unless: :attr_presence_not_required? validates :postal_code, presence: true, unless: :attr_presence_not_required? validates :door_no, presence: true, unless: :attr_presence_not_required? validates :province, presence: true, unless: :attr_presence_not_required? validates :city, presence: true, unless: :attr_presence_not_required? validates :long, presence: true, if: :attr_presence_not_required? validates :lat, presence: true, if: :attr_presence_not_required? attr_accessor :postal_code_id before_save :clean_up def clean_up self.adr_1.strip! end def attr_presence_not_required? false end def to_s "#{self.door_no} #{self.adr_1} #{self.adr_2}, #{'apt.' + self.apt unless self.apt.blank?} #{self.city} #{self.postal_code}" end end end
Version data entries
8 entries across 8 versions & 1 rubygems