class ActiveTree::ModelQuery

Attributes

initial_scope[RW]

Public Class Methods

new(initial_scope = ::ActiveTree::Model.all) click to toggle source
# File lib/active_tree/queries/model_query.rb, line 4
def initialize(initial_scope = ::ActiveTree::Model.all)
    @initial_scope = initial_scope
end

Public Instance Methods

call(params) click to toggle source
# File lib/active_tree/queries/model_query.rb, line 8
def call(params)
    scope = simple_search(initial_scope, :id, params[:id])
    [:owner_type, :owner_id, :status, :data_external_id, :data_provider, :type, :parent_entity_id, :parent_entity_type, :path_slug].each do |query|
        scope = simple_search(scope, query, params[query])
    end

    scope = by_search(scope, params[:search])

    scope
end