Sha256: 8155d8f66313f65eefcb0b6cb92de5a089c9c1ca73424b18d05c7498c0a3d3a9
Contents?: true
Size: 665 Bytes
Versions: 2
Compression:
Stored size: 665 Bytes
Contents
# frozen_string_literal: true module Tramway::Partner::Scopes extend ActiveSupport::Concern included do ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type| define_method partnership_type.pluralize.to_sym do query = <<-SQL tramway_partner_partnerships.partnership_type = '#{partnership_type}' AND tramway_partner_partnerships.partner_id = '#{id}' AND tramway_partner_partnerships.state = 'active' AND tramway_partner_partnerships.partner_type = '#{self.class.name}' SQL Tramway::Partner::Organization.joins(:partnerships).where(query) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tramway-partner-1.0.4 | lib/tramway/partner/scopes.rb |
tramway-partner-1.0.3.2 | lib/tramway/partner/scopes.rb |