Sha256: 568dad542fdfe58fd326f42aee0df8153ca66abf71badff5f281e61e2cecf1db

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

module JsonApiFilter
  class AutoJoin
  
    attr_reader :association_name, :scope
    
    # @param [ActiveRecord::Base, ActiveRecord_Relation] scope
    # @param [String, Symbol] association_name
    def initialize(scope, association_name)
      @association_name = association_name
      @scope = scope
    end
    
    def predicate
      scope.joins(association_name.to_sym)
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_api_filter-0.3.2 lib/json_api_filter/auto_join.rb
json_api_filter-0.2 lib/json_api_filter/auto_join.rb