Module: ActiveRecord::SqlMapper

Defined in:
lib/sql_mapper.rb

Defined Under Namespace

Classes: Context, HashExecStrategy, ObjectExecStrategy, QueryMapping, StructExecStrategy

Constant Summary collapse

EXEC_STRATEGIES =

Json execution strategy?

{
  :object => ObjectExecStrategy,
  Struct => StructExecStrategy,
  Hash => HashExecStrategy
}

Class Method Summary collapse

Class Method Details

.config(&block) ⇒ Object



6
7
8
# File 'lib/sql_mapper.rb', line 6

def self.config(&block)
  Context.instance.instance_exec &block
end

.fetch(opts = {}) ⇒ Object



10
11
12
13
14
# File 'lib/sql_mapper.rb', line 10

def self.fetch(opts={})
  strategy = get_strategy_for(*sql_and_result_class_for(opts))
  strategy.do_fetch
  strategy.process_results
end

.fetch_one(opts = {}) ⇒ Object



16
17
18
# File 'lib/sql_mapper.rb', line 16

def self.fetch_one(opts={})
  fetch(opts)[0]
end