1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/models/sponsor.rb

11 lines
496 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Sponsor < ActiveRecord::Base
2016-08-06 13:37:57 -04:00
belongs_to :sponsor_club, class_name: "Club", foreign_key: "club_id"
belongs_to :sponsorable, polymorphic: true
belongs_to :sponsor, polymorphic: true
2016-08-06 13:37:57 -04:00
belongs_to :thing, polymorphic: true, foreign_type: :sponsorable_type, foreign_key: :sponsorable_id
belongs_to :sponsorable_with_conditions, -> { where name: "Ernie" }, polymorphic: true,
2016-08-06 13:37:57 -04:00
foreign_type: "sponsorable_type", foreign_key: "sponsorable_id"
end