Created
July 22, 2019 11:58
-
-
Save flash-gordon/8fb0096805201c3cad4e0fd72a073103 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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