Class: Babik::Selection::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/babik/queryset/lib/selection/selection.rb

Overview

Represents a filter selection (that can be filtered in WHERE)

Class Method Summary collapse

Class Method Details

.factory(model, selection_path, value) ⇒ Object

Factory Method used to create local and foreign selections



11
12
13
14
15
# File 'lib/babik/queryset/lib/selection/selection.rb', line 11

def self.factory(model, selection_path, value)
  is_foreign_selection = selection_path.match?(Babik::Selection::Config::RELATIONSHIP_SEPARATOR)
  return Babik::Selection::ForeignSelection.new(model, selection_path, value) if is_foreign_selection
  Babik::Selection::LocalSelection.new(model, selection_path, value)
end