Last active
August 29, 2015 14:02
-
-
Save merqlove/3f5f270d30c7a2f4756c to your computer and use it in GitHub Desktop.
Domain based scheme selection in Sinatra via Postgres-Schemata extension for Sequel.
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
before do | |
case env["SERVER_NAME"] | |
when /test\./ | |
App.db.search_path = [:test, :public] | |
when /test2\./ | |
App.db.search_path = [:test2, :public] | |
else | |
App.db.search_path = [:public] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment