Sha256: adfedaf417a97d73d89039e664c262a0d25f84e172d84aaed45b8705353fe76b

Contents?: true

Size: 531 Bytes

Versions: 11

Compression:

Stored size: 531 Bytes

Contents

module Martyr
  module Runtime
    class SubFactScope < BaseFactScope

      delegate :add_to_join, to: :fact_definition

      def add_to_join(main_fact_scope)
        raise Schema::Error.new("Sub query #{name} does not have a join clause. Did you forget to call `joins_with`?") unless fact_definition.join_clause
        main_fact_scope.decorate_scope do |scope|
          scope.joins("#{fact_definition.join_clause} (#{scope_sql}) #{fact_definition.name} ON #{fact_definition.join_on}")
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
martyr-0.1.85.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.84.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.82.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.81.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.80.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.79.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.78.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.77.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.76.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.75.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb
martyr-0.1.74.pre lib/martyr/runtime/fact_scopes/sub_fact_scope.rb