Class: ThinkingSphinx::ActiveRecord::ColumnSQLPresenter

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

Instance Method Summary collapse

Constructor Details

#initialize(model, column, adapter, associations) ⇒ ColumnSQLPresenter

Returns a new instance of ColumnSQLPresenter.



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

def initialize(model, column, adapter, associations)
  @model, @column, @adapter, @associations = model, column, adapter, associations
end

Instance Method Details

#aggregate?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/thinking_sphinx/active_record/column_sql_presenter.rb', line 8

def aggregate?
  path.aggregate?
rescue Joiner::AssociationNotFound
  false
end

#with_tableObject



14
15
16
17
18
19
20
21
# File 'lib/thinking_sphinx/active_record/column_sql_presenter.rb', line 14

def with_table
  return __name if string?
  return nil unless exists?

  quoted_table = escape_table? ? escape_table(table) : table

  "#{quoted_table}.#{adapter.quote __name}"
end