class ThinkingSphinx::ActiveRecord::ColumnSQLPresenter
Attributes
adapter[R]
associations[R]
column[R]
model[R]
Public Class Methods
new(model, column, adapter, associations)
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 2 def initialize(model, column, adapter, associations) @model, @column, @adapter, @associations = model, column, adapter, associations end
Public Instance Methods
aggregate?()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 6 def aggregate? path.aggregate? rescue Joiner::AssociationNotFound false end
with_table()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 12 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
Private Instance Methods
escape_table(table_name)
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 27 def escape_table(table_name) table_name.split('.').map { |t| adapter.quote(t) }.join('.') end
escape_table?()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 31 def escape_table? table[/[`"]/].nil? end
exists?()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 35 def exists? path.model.column_names.include?(column.__name.to_s) rescue Joiner::AssociationNotFound false end
path()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 41 def path Joiner::Path.new model, column.__stack end
table()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 45 def table associations.alias_for __stack end
version()
click to toggle source
# File lib/thinking_sphinx/active_record/column_sql_presenter.rb, line 49 def version ActiveRecord::VERSION end