aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/models/sponsor.rb
blob: 18ff103ffe6e8782af1c1862f0e9b60f262be7ff (plain) (tree)
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 :sponsor, 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