Class: ActiveRecord::SqlMapper::ObjectExecStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/sql_mapper.rb

Direct Known Subclasses

StructExecStrategy

Instance Method Summary collapse

Constructor Details

#initialize(sql, result_class) ⇒ ObjectExecStrategy

Returns a new instance of ObjectExecStrategy.



59
60
61
62
# File 'lib/sql_mapper.rb', line 59

def initialize(sql, result_class)
  @sql = sql
  @result_class = result_class
end

Instance Method Details

#do_fetchObject



64
65
66
# File 'lib/sql_mapper.rb', line 64

def do_fetch
  @raw_results = ActiveRecord::Base.connection.exec_query(@sql)
end

#process_resultsObject



68
69
70
# File 'lib/sql_mapper.rb', line 68

def process_results
  @raw_results.rows.map &instantiate_result_using_row
end