Method: SearchObject::Search.build_for

Defined in:
lib/search_object/search.rb

.build_for(config, options) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
# File 'lib/search_object/search.rb', line 6

def build_for(config, options)
  scope   = options.fetch(:scope) { config[:scope] && config[:scope].call }
  filters = Helper.stringify_keys(options.fetch(:filters, {}))
  params  = config[:defaults].merge Helper.select_keys(filters, config[:actions].keys)

  raise MissingScopeError unless scope

  new scope, params, config[:actions]
end