Sha256: cdd8b266e0fe1b9ea176dcf018f15a8316125ed103418483ea3e0eb4b54efe13

Contents?: true

Size: 704 Bytes

Versions: 10

Compression:

Stored size: 704 Bytes

Contents

class Club < ActiveRecord::Base
  has_one :membership
  has_many :memberships, :inverse_of => false
  has_many :members, :through => :memberships
  has_one :sponsor
  has_one :sponsored_member, :through => :sponsor, :source => :sponsorable, :source_type => "Member"
  belongs_to :category

  has_many :favourites, -> { where(memberships: { favourite: true }) }, through: :memberships, source: :member

  private

  def private_method
    "I'm sorry sir, this is a *private* club, not a *pirate* club"
  end
end

class SuperClub < ActiveRecord::Base
  self.table_name = "clubs"

  has_many :memberships, class_name: 'SuperMembership', foreign_key: 'club_id'
  has_many :members, through: :memberships
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ibm_db-3.0.4-x86-mingw32 test/models/club.rb
ibm_db-3.0.4 test/models/club.rb
ibm_db-3.0.3-x86-mingw32 test/models/club.rb
ibm_db-3.0.3 test/models/club.rb
ibm_db-3.0.2-x86-mingw32 test/models/club.rb
ibm_db-3.0.2 test/models/club.rb
activejob-lock-0.0.2 rails/activerecord/test/models/club.rb
ibm_db-3.0.1 test/models/club.rb
ibm_db-3.0.1-x86-mingw32 test/models/club.rb
activejob-lock-0.0.1 rails/activerecord/test/models/club.rb