aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/sponsor.rb
blob: f190860fd1c8f6d39da6a92f51d29d4dffdc862d (plain) (blame)
1
2
3
4
5
6
7
8
9
# frozen_string_literal: true

class Sponsor < ActiveRecord::Base
  belongs_to :sponsor_club, class_name: "Club", foreign_key: "club_id"
  belongs_to :sponsorable, polymorphic: true
  belongs_to :thing, polymorphic: true, foreign_type: :sponsorable_type, foreign_key: :sponsorable_id
  belongs_to :sponsorable_with_conditions, -> { where name: "Ernie" }, polymorphic: true,
             foreign_type: "sponsorable_type", foreign_key: "sponsorable_id"
end