Class: ActiveRecord::SqlMapper::ObjectExecStrategy
- Inherits:
-
Object
- Object
- ActiveRecord::SqlMapper::ObjectExecStrategy
- Defined in:
- lib/sql_mapper.rb
Direct Known Subclasses
Instance Method Summary collapse
- #do_fetch ⇒ Object
-
#initialize(sql, result_class) ⇒ ObjectExecStrategy
constructor
A new instance of ObjectExecStrategy.
- #process_results ⇒ Object
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_fetch ⇒ Object
64 65 66 |
# File 'lib/sql_mapper.rb', line 64 def do_fetch @raw_results = ActiveRecord::Base.connection.exec_query(@sql) end |
#process_results ⇒ Object
68 69 70 |
# File 'lib/sql_mapper.rb', line 68 def process_results @raw_results.rows.map &instantiate_result_using_row end |