Git Product home page Git Product logo

Comments (8)

schneems avatar schneems commented on July 25, 2024

Rails 4 is supposed to support a DATABASE_URL environment variable out of the box, so writing a database.yml should no longer be required, however there has been some back and forth on the code in question.

from heroku-buildpack-ruby.

catsby avatar catsby commented on July 25, 2024

@schneems do you know if Rails 4 prefers that DATABASE_URL? If not, then if you had a preexisting database.yml with the default production.sqlite3 in the production: setting that it would be bad... make sense? I don't currently have a Rails 4 app up on Heroku yet though to see.

from heroku-buildpack-ruby.

hone avatar hone commented on July 25, 2024

Can you provide specific issues you're seeing here? What isn't working? Stacktraces? Commands run?

Thanks.

from heroku-buildpack-ruby.

vincentwoo avatar vincentwoo commented on July 25, 2024

@hone Upon reading this thread, I realized that it was probably my fault. I double checked, and the problem was actually that the pg addon doesn't give db:reset privileges, which I interpreted to mean that my database connection from rails was failing. It appears to work fine now, so I'll close this out.

from heroku-buildpack-ruby.

gkop avatar gkop commented on July 25, 2024

This is quite annoying. I have a worker script in my rails 4 app that loads active record and connects to my heroku postgres without loading rails. I spent quite a few minutes banging my head against the wall before finding this issue and forking the buildpack for a quick fix. Perhaps this new behavior could be opt-in?

from heroku-buildpack-ruby.

catsby avatar catsby commented on July 25, 2024

Hey @gkop, you should be able to load your current database connection from the DATABASE_URL environment variable with ActiveRecord::Base.establish_connection, were you trying that or trying to read from database.yml?

from heroku-buildpack-ruby.

gkop avatar gkop commented on July 25, 2024

Hi @catsby.

This complained that I didn't specify an adapter:

ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])

And this didn't respect the url:

ActiveRecord::Base.establish_connection(adapter: "postgres", url: ENV['DATABASE_URL'])

Using Rails from git rails/rails@b5e4eb2.

My web dyno, where I load rails, is perfectly happy... it's the worker dyno, where I use active record on its own, that I miss database.yml.

from heroku-buildpack-ruby.

catsby avatar catsby commented on July 25, 2024

ah, my mistake, I recall that being in issue in at least rc1.

from heroku-buildpack-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.