Sha256: e890905a9f93af76721fb6a5e217cce708aa51dfbe4e7b21cbd0594a93ba78cd
Contents?: true
Size: 656 Bytes
Versions: 8
Compression:
Stored size: 656 Bytes
Contents
module Searchlogic module Condition class SiblingOf < NestedSet def to_conditions(value) parent_association = klass.reflect_on_association(:parent) foreign_key_name = (parent_association && parent_association.options[:foreign_key]) || "parent_id" parent_id = (value.is_a?(klass) ? value : klass.find(value)).send(foreign_key_name) condition = ChildOf.new(klass, options) condition.value = parent_id merge_conditions(["#{quoted_table_name}.#{quote_column_name(klass.primary_key)} != ?", (value.is_a?(klass) ? value.send(klass.primary_key) : value)], condition.sanitize) end end end end
Version data entries
8 entries across 8 versions & 2 rubygems