Skip to content

Instantly share code, notes, and snippets.

@snusnu
Forked from hassox/gist:306313
Created February 17, 2010 04:57
Show Gist options
  • Save snusnu/306316 to your computer and use it in GitHub Desktop.
Save snusnu/306316 to your computer and use it in GitHub Desktop.
class ShardingMiddleware
def initialize(app)
@app = app
end
def call(env)
env['warden'].authenticate!
repo_name = env['warden'].account.repository_name
result = nil
DataMapper.repository(repo_name) do
result = @app.call(env)
end
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment