Sha256: a441a967792a849d90efec954854f7b062261bb95e026a6ed83a10fc85189f6b

Contents?: true

Size: 431 Bytes

Versions: 8

Compression:

Stored size: 431 Bytes

Contents

module JsonapiCompliable
  class Scope::Sideload < Scope::Base
    def apply
      params[:include] ? super : @scope
    end

    def custom_scope
      dsl.sideloads[:custom_scope]
    end

    def apply_standard_scope
      @scope.includes(scrubbed)
    end

    def apply_custom_scope
      custom_scope.call(@scope, scrubbed)
    end

    private

    def scrubbed
      Util::IncludeParams.scrub(controller)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jsonapi_compliable-0.4.0 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.10 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.9 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.8 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.7 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.6 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.5 lib/jsonapi_compliable/scope/sideload.rb
jsonapi_compliable-0.3.4 lib/jsonapi_compliable/scope/sideload.rb