Skip to content

Instantly share code, notes, and snippets.

@merqlove
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merqlove/3f5f270d30c7a2f4756c to your computer and use it in GitHub Desktop.
Save merqlove/3f5f270d30c7a2f4756c to your computer and use it in GitHub Desktop.
Domain based scheme selection in Sinatra via Postgres-Schemata extension for Sequel.
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