class ThinkingSphinx::ActiveRecord::SimpleManyQuery
Public Instance Methods
to_s()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 4 def to_s "#{identifier} from #{source_type}; #{queries.join('; ')}" end
Private Instance Methods
quoted_foreign_key()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 14 def quoted_foreign_key quote_with_table reflection.join_table, reflection.foreign_key end
quoted_primary_key()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 18 def quoted_primary_key quote_with_table reflection.join_table, reflection.association_foreign_key end
range_sql()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 22 def range_sql "SELECT MIN(#{quoted_foreign_key}), MAX(#{quoted_foreign_key}) FROM #{quote_column reflection.join_table}" end
reflection()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 10 def reflection @reflection ||= source.model.reflect_on_association column.__stack.first end
to_sql()
click to toggle source
# File lib/thinking_sphinx/active_record/simple_many_query.rb, line 26 def to_sql selects = [ "#{quoted_foreign_key} #{offset} AS #{quote_column('id')}", "#{quoted_primary_key} AS #{quote_column(property.name)}" ] sql = "SELECT #{selects.join(', ')} FROM #{quote_column reflection.join_table}" sql += " WHERE (#{quoted_foreign_key} BETWEEN $start AND $end)" if ranged? sql end