So here is a sample class
class Company < ActiveRecord::Base
has_many :investments
has_many :vc_firms, through: :investments, source: :investor, source_type: 'VentureFirm'
has_many :angels, through: :investments, source: :investor, source_type: 'Person'
end
@company.angels and @company.vc_firms works as expected. But how would I have @company.investors that are comprised of both source types? That would work for all polymorphics on the investor column of the Investments table? or perhaps a way of using a scope to merge all source_type?
Investment model looks like this:
class Investment < ActiveRecord::Base
belongs_to :investor, polymorphic: true
belongs_to :company
validates :funding_series, presence: true #, uniqueness: {scope: :company}
validates :funded_year, presence: true, numericality: true
end
Angels are associated through the Person model
class Person < ActiveRecord::Base
has_many :investments, as: :investor
end
Relevant financial organization model associations:
class FinancialOrganization < ActiveRecord::Base
has_many :investments, as: :investor
has_many :companies, through: :investments
end