Sha256: a241cf61b9f4baf4d303246f2f5710ccc6396d6df34312d6793b2726e21ee027

Contents?: true

Size: 439 Bytes

Versions: 7

Compression:

Stored size: 439 Bytes

Contents

module Searchlogic
  module Condition
    class ChildOf < Tree      
      def to_conditions(value)
        parent_association = klass.reflect_on_association(:parent)
        foreign_key_name = (parent_association && parent_association.options[:foreign_key]) || "parent_id"
        ["#{quoted_table_name}.#{quote_column_name(foreign_key_name)} = ?", (value.is_a?(klass) ? value.send(klass.primary_key) : value)]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
searchlogic-1.5.9 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.6 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.8 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.4 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.7 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.10 lib/searchlogic/condition/child_of.rb
searchlogic-1.5.3 lib/searchlogic/condition/child_of.rb