Class: EvilQuery::Base

Inherits:
Object
  • Object
show all
Includes:
Diaspora::Logging
Defined in:
lib/evil_query.rb

Instance Method Summary collapse

Instance Method Details

#fetch_ids!(relation, id_column) ⇒ Object


7
8
9
10
# File 'lib/evil_query.rb', line 7

def fetch_ids!(relation, id_column)
  #the relation should be ordered and limited by here
  @class.connection.select_values(id_sql(relation, id_column))
end

#id_sql(relation, id_column) ⇒ Object


12
13
14
# File 'lib/evil_query.rb', line 12

def id_sql(relation, id_column)
  @class.connection.unprepared_statement { relation.select(id_column).to_sql }
end