Sha256: 52b28df9ebd314bb638573341a2a050582a9ede01d78124698fc6716bac1595f

Contents?: true

Size: 943 Bytes

Versions: 4

Compression:

Stored size: 943 Bytes

Contents

module Mack
  module DataMapper # :nodoc:
    # 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
    class RepositoryRunnerHelper < Mack::RunnerHelpers::Base
      
      def start(request, response, cookies)
        ::DataMapper::Repository.context << ::DataMapper::Repository.new(configatron.mack.data_mapper.repository_runner_context)
      end
      
      def complete(request, response, cookies)
        ::DataMapper::Repository.context.pop
      end
      
    end
  end
end

Mack::RunnerHelpers::Registry.add(Mack::DataMapper::RepositoryRunnerHelper) if configatron.mack.data_mapper.use_repository_runner

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mack-data_mapper-0.8.1 lib/mack-data_mapper/repo_runner_helper.rb
mack-data_mapper-0.8.2 lib/mack-data_mapper/repo_runner_helper.rb
mack-data_mapper-0.8.3 lib/mack-data_mapper/repo_runner_helper.rb
mack-data_mapper-0.8.3.1 lib/mack-data_mapper/repo_runner_helper.rb