Class: ActiveRecord::SqlMapper::HashExecStrategy
- Inherits:
-
Object
- Object
- ActiveRecord::SqlMapper::HashExecStrategy
- Defined in:
- lib/sql_mapper.rb
Instance Method Summary collapse
- #do_fetch ⇒ Object
-
#initialize(sql, result_class) ⇒ HashExecStrategy
constructor
A new instance of HashExecStrategy.
- #process_results ⇒ Object
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_fetch ⇒ Object
104 105 106 |
# File 'lib/sql_mapper.rb', line 104 def do_fetch @raw_results = ActiveRecord::Base.connection.select_all(@sql) end |
#process_results ⇒ Object
108 109 110 |
# File 'lib/sql_mapper.rb', line 108 def process_results @raw_results.map{|hash| symbolize_hash hash} end |