Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. require 'bundler/setup'
  2. Bundler.require
  3.  
  4. configure :development do
  5. ENV['SINATRA_ENV'] ||= "development"
  6.  
  7. ActiveRecord::Base.establish_connection(
  8. :adapter => "sqlite3",
  9. :database => "db/neighborhood#{ENV['SINATRA_ENV']}.sqlite"
  10. )
  11. end
  12.  
  13. configure :production do
  14. db = URI.parse(ENV['DATABASE_URL'] || 'postgres://localhost/mydb')
  15.  
  16. ActiveRecord::Base.establish_connection(
  17. :adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
  18. :host => db.host,
  19. :username => db.user,
  20. :password => db.password,
  21. :database => db.path[1..-1],
  22. :encoding => 'utf8'
  23. )
  24. end
  25.  
  26. require_all 'app'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement