Class: ActiveRecord::SqlMapper::StructExecStrategy

Inherits:
ObjectExecStrategy show all
Defined in:
lib/sql_mapper.rb

Instance Method Summary collapse

Methods inherited from ObjectExecStrategy

#process_results

Constructor Details

#initialize(sql, result_class) ⇒ StructExecStrategy

Returns a new instance of StructExecStrategy.



79
80
81
# File 'lib/sql_mapper.rb', line 79

def initialize(sql, result_class)
  super(sql, result_class)
end

Instance Method Details

#do_fetchObject



83
84
85
86
# File 'lib/sql_mapper.rb', line 83

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