Sha256: 0e35aadf82dd3acd06d9a84c20cd43105e8f534584a5c241cda6abb0c5b166da
Contents?: true
Size: 650 Bytes
Versions: 6
Compression:
Stored size: 650 Bytes
Contents
module Searchgasm module Condition class SiblingOf < Tree 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
6 entries across 6 versions & 1 rubygems