Skip to content

Instantly share code, notes, and snippets.

@flash-gordon
Created July 22, 2019 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flash-gordon/8fb0096805201c3cad4e0fd72a073103 to your computer and use it in GitHub Desktop.
Save flash-gordon/8fb0096805201c3cad4e0fd72a073103 to your computer and use it in GitHub Desktop.
class SetSearchPath
def initialize(app, rom)
@app = app
@connection = rom.gateways[:default].connection
end
def call(env)
@connection.synchronize do
@connection.execute("set seatch_path to #{env['tenant.schema_name']}")
@app.call(env)
end
end
end
__END__
# Then somewhere in the routing engine
use SetSearchPath, rom_container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment