Sha256: f10419433105eccdd8641cfa785734fe97159f300ac2db6f00d4858954222f46
Contents?: true
Size: 561 Bytes
Versions: 9
Compression:
Stored size: 561 Bytes
Contents
class Building < ActiveRecord::Base belongs_to :owner, :class_name => 'Person', :counter_cache => true has_many :floors, :dependent => :delete_all has_one :address, :as => :addressable has_many :tenants, :through => :floors, :class_name => 'Person' if Rails.version < '4.1' after_update :update_buildings_count, :if => :owner_id_changed? def update_buildings_count Person.decrement_counter(:buildings_count, owner_id_was) if owner_id_was Person.increment_counter(:buildings_count, owner_id) if owner_id end end end
Version data entries
9 entries across 9 versions & 1 rubygems