Class: ThinkingSphinx::ActiveRecord::PropertyQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/property_query.rb

Direct Known Subclasses

SimpleManyQuery

Instance Method Summary collapse

Constructor Details

#initialize(property, source, type = nil) ⇒ PropertyQuery

Returns a new instance of PropertyQuery.



4
5
6
# File 'lib/thinking_sphinx/active_record/property_query.rb', line 4

def initialize(property, source, type = nil)
  @property, @source, @type = property, source, type
end

Instance Method Details

#to_sObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/thinking_sphinx/active_record/property_query.rb', line 8

def to_s
  if unsafe_habtm_column?
    raise <<-MESSAGE
Source queries cannot be used with HABTM joins if they use anything beyond the
primary key.
    MESSAGE
  end

  if safe_habtm_column?
    ThinkingSphinx::ActiveRecord::SimpleManyQuery.new(
      property, source, type
    ).to_s
  else
    "#{identifier} from #{source_type}; #{queries.join('; ')}"
  end
end