Issue with ActiveRecord 4.2 in non Rails app

Hello,

I’ve been using ActiveRecord and ActionMailer outside Rails.

Versions: 4.1.7

Recently wanted to update to 4.2.0 and got an issue:

NoMethodError: undefined method `env' for Rails:Module
/Users/user/.rvm/gems/ruby-2.1.2/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:3:in `block in <module:ConnectionHandling>'

I’ve also commented in the commit, so you can have a look for more info there.

https://github.com/rails/rails/commit/290e8e117fd33189fec25d13b37e686b27247ad1#commitcomment-9757150

Any ideas on how to solve it?

Thank you!

Giedrius

No one else is having issues with migrations in non rails apps?

http://recipes.sinatrarb.com/p/models/active_record

–Rob

I’ve also commented in the commit, so you can have a look for more info there.

https://github.com/rails/rails/commit/290e8e117fd33189fec25d13b37e686b27247ad1#commitcomment-9757150

Given that it is apparently fixed on 4-2 stable, have you tried one of the 4.2.1 release candidates?

Fred

Hi Fred,

Thanks. Apparently it has been fixed in this release, because migrations now work in 4.2.1rc3, though I couldn’t find specific bugfix commit.