Sha256: eb67f9b7a2035e98aa3fd46d4005b1405482541102501566c7b8dca8de8fe849

Contents?: true

Size: 365 Bytes

Versions: 21

Compression:

Stored size: 365 Bytes

Contents

class AreaUser < ActiveRecord::Base
  self.table_name = 'areas_users'
  
  belongs_to :area
  belongs_to :user
  
  after_create :increment_area_users_count
  after_destroy :decrement_area_users_count
  
  private
  
  def increment_area_users_count
    area.users_count.increment!
  end
  
  def decrement_area_users_count
    area.users_count.decrement!
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/models/area_user.rb
voluntary-0.7.0 app/models/area_user.rb
voluntary-0.6.0 app/models/area_user.rb
voluntary-0.5.2 app/models/area_user.rb
voluntary-0.5.1 app/models/area_user.rb
voluntary-0.5.0 app/models/area_user.rb
voluntary-0.4.0 app/models/area_user.rb
voluntary-0.3.0 app/models/area_user.rb
voluntary-0.2.4 app/models/area_user.rb
voluntary-0.2.3 app/models/area_user.rb
voluntary-0.2.2 app/models/area_user.rb
voluntary-0.2.1 app/models/area_user.rb
voluntary-0.2.0 app/models/area_user.rb
voluntary-0.1.0 app/models/area_user.rb
voluntary-0.1.0.rc4 app/models/area_user.rb
voluntary-0.1.0.rc3 app/models/area_user.rb
voluntary-0.1.0.rc2 app/models/area_user.rb
voluntary-0.1.0.rc1 app/models/area_user.rb
voluntary-0.0.3 app/models/area_user.rb
voluntary-0.0.2 app/models/area_user.rb