Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. staging:
  2. adapter: <%= ENV['DATABASE_ADAPTER'] %>
  3. encoding: <%= ENV['DATABASE_ENCODING'] %>
  4. database: <%= ENV['DATABASE'] %>
  5. host: <%= ENV['DATABASE_HOST'] %>
  6. port: <%= ENV['DATABASE_PORT'].to_i %>
  7. pool: <%= ENV['DATABASE_POOL'].to_i %>
  8. username: <%= ENV['DATABASE_USERNAME'] %>
  9. password: <%= ENV['DATABASE_PASSWORD'] %>
  10.  
  11. /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in
  12. `require': Could not load 'active_record/connection_adapters/<%= ENV['DATABASE_ADAPTER'] %>_adapter'.
  13. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3'
  14. add the necessary adapter gem to the Gemfile. (LoadError)
  15.  
  16. def database_configuration
  17. yaml = Pathname.new(paths["config/database"].existent.first || "")
  18.  
  19. config = if yaml.exist?
  20. require "yaml"
  21. require "erb"
  22. YAML.load(ERB.new(yaml.read).result) || {}
  23. elsif ENV['DATABASE_URL']
  24. # Value from ENV['DATABASE_URL'] is set to default database connection
  25. # by Active Record.
  26. {}
  27. else
  28. raise "Could not load database configuration. No such file - #{yaml}"
  29. end
  30.  
  31. config
  32. rescue Psych::SyntaxError => e
  33. raise "YAML syntax error occurred while parsing #{paths["config/database"].first}. "
  34. "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. "
  35. "Error: #{e.message}"
  36. rescue => e
  37. raise e, "Cannot load `Rails.application.database_configuration`:n#{e.message}", e.backtrace
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement