Class: Searchgasm::Condition::InclusiveDescendantOf

Inherits:
Tree
  • Object
show all
Defined in:
lib/searchgasm/condition/inclusive_descendant_of.rb

Instance Attribute Summary

Attributes inherited from Base

#column, #klass

Instance Method Summary collapse

Methods inherited from Tree

name_for_column, name_for_klass

Methods inherited from Base

aliases_for_column, aliases_for_klass, comparable_column?, #condition_name, condition_name, #explicitly_set_value=, #explicitly_set_value?, ignore_blanks?, #initialize, #name, name_for_column, name_for_klass, #quote_column_name, #quote_table_name, #quoted_column_name, #quoted_table_name, #sanitize, string_column?, type_cast_value?, #value, #value=

Constructor Details

This class inherits a constructor from Searchgasm::Condition::Base

Instance Method Details

#to_conditions(value) ⇒ Object



4
5
6
7
8
# File 'lib/searchgasm/condition/inclusive_descendant_of.rb', line 4

def to_conditions(value)
  condition = DescendantOf.new(klass, column)
  condition.value = value
  merge_conditions(["#{quoted_table_name}.#{quote_column_name(klass.primary_key)} = ?", (value.is_a?(klass) ? value.send(klass.primary_key) : value)], condition.sanitize, :any => true)
end