Sha256: 320c2aa43d4a01a5a55e8abbd3bc07d082ec5695d0bd1d8829ddf5156810f064
Contents?: true
Size: 494 Bytes
Versions: 4
Compression:
Stored size: 494 Bytes
Contents
# -*- coding: utf-8 -*- require 'sinatra/base' require 'sequel' module Sinatra # wrap routed request with sequel transaction block. module SequelTransaction module Helpers private def route_eval(&block) db = Sequel::DATABASES.first ret = nil db.transaction do ret = instance_eval(&block) end throw :halt, ret end end def self.registered(app) app.helpers SequelTransaction::Helpers end end end
Version data entries
4 entries across 4 versions & 2 rubygems