Sha256: d8edd7b09f769489d00363bea4156174d92e6f332caa461c5bfc8ab93a316273
Contents?: true
Size: 812 Bytes
Versions: 55
Compression:
Stored size: 812 Bytes
Contents
module ThinkingSphinx class Join attr_accessor :source, :column, :associations def initialize(source, column) @source = source @column = column @associations = association_stack(column.__path.clone).each { |assoc| assoc.join_to(source.base) } source.joins << self end private # Gets a stack of associations for a specific path. # def association_stack(path, parent = nil) assocs = [] if parent.nil? assocs = @source.association(path.shift) else assocs = parent.children(path.shift) end until path.empty? point = path.shift assocs = assocs.collect { |assoc| assoc.children(point) }.flatten end assocs end end end
Version data entries
55 entries across 55 versions & 7 rubygems