Module: WhereLower::Base

Defined in:
lib/where_lower/base.rb

Overview

Internal API to be called from extension methods

Class Method Summary collapse

Class Method Details

.spawn_lower_scope(scope, fields) ⇒ ActiveRecord::Relation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Spawn a new scope based on existing scope and hash This is method is for internal use

Returns:

  • (ActiveRecord::Relation)

See Also:

  • ``.spawn_lower_scope_by_type`


27
28
29
30
31
# File 'lib/where_lower/base.rb', line 27

def spawn_lower_scope(scope, fields)
  fields.inject(scope) do |new_scope, (name, value)|
    spawn_lower_scope_by_type(new_scope, name, value)
  end
end

.spawn_lower_scope_by_type(scope, column_or_table_name, value) ⇒ ActiveRecord::Relation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This is method is for internal use

Returns:

  • (ActiveRecord::Relation)

Raises:



46
47
48
# File 'lib/where_lower/base.rb', line 46

def spawn_lower_scope_by_type(scope, column_or_table_name, value)
  ScopeSpawner.spawn(scope, column_or_table_name, value)
end