aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/models/sponsor.rb
blob: 3f142b25fe23e99fb9bd41f2b65b929886e7dfa7 (plain) (tree)
1
2
3
4
5
6
7
                                  


                                                                                                     
                                                                                         
                                                                            
   
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