Class: ActiveRecord::SqlMapper::HashExecStrategy

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

Instance Method Summary collapse

Constructor Details

#initialize(sql, result_class) ⇒ HashExecStrategy

Returns a new instance of HashExecStrategy.



99
100
101
102
# File 'lib/sql_mapper.rb', line 99

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

Instance Method Details

#do_fetchObject



104
105
106
# File 'lib/sql_mapper.rb', line 104

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

#process_resultsObject



108
109
110
# File 'lib/sql_mapper.rb', line 108

def process_results
  @raw_results.map{|hash| symbolize_hash hash}
end