Class: Mack::DataMapper::RepositoryRunnerHelper

Inherits:
RunnerHelpers::Base
  • Object
show all
Defined in:
lib/mack-data_mapper/repo_runner_helper.rb

Overview

This runner helper will wrap a request with a DataMapper::Repository. To turn on this runner set the following configuration value equal to true:

configatron.mack.data_mapper.use_repository_runner = true

To set the context in which the runner helper runs, set this configuration value:

configatron.mack.data_mapper.repository_runner_context = :default

Instance Method Summary collapse

Instance Method Details

#complete(request, response, cookies) ⇒ Object



14
15
16
# File 'lib/mack-data_mapper/repo_runner_helper.rb', line 14

def complete(request, response, cookies)
  ::DataMapper::Repository.context.pop
end

#start(request, response, cookies) ⇒ Object



10
11
12
# File 'lib/mack-data_mapper/repo_runner_helper.rb', line 10

def start(request, response, cookies)
  ::DataMapper::Repository.context << ::DataMapper::Repository.new(configatron.mack.data_mapper.repository_runner_context)
end