mkb / riak-shim

A tiny shim between you and riak-client. Reads database config and handles a little plumbing for marshalling and unmarshalling your models.
MIT License
8 stars 3 forks source link

Overriding of database.yml confuses ActiveRecord #5

Open orospakr opened 10 years ago

orospakr commented 10 years ago

Rails bundles ActiveRecord, which on start will try to read its own config from database.yml, causing this error:

ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified

That said, I don't intend to use AR in the app, so, flat out disabling AR in some way might be the right answer.

mkb commented 10 years ago

Sorry I didn't see this until just now. Thanks for pointing it out!

I've been using Riak in non-Rails, non-AR apps so that hasn't been an issue for me, but there are plenty of situations where you might want both ActiveRecord and Riak in the same app. I'll poke into this and come up with a fix.

Were you able to find a workaround in the meantime?

orospakr commented 10 years ago

I'm in the same boat as you, I don't need ActiveRecord. :)

I figured somebody might do, though!

mkb commented 10 years ago

Agreed! I'll cook something up. Thanks for the suggestion.

Are you using riak-shim? How is it working for you?

orospakr commented 10 years ago

Generally pretty well. Have a look at my fork (for my startup) where I have a few (mostly) tested changes that fix (or change) various things. https://github.com/Miralaw/riak-shim/commits/master

orospakr commented 10 years ago

Oh yeah, it seems that relating to this specific bug I changed it to riak.yml.

mkb commented 10 years ago

Ooh nice. Lots of good stuff there. Definitely some changes I'd like to pull in.

orospakr commented 10 years ago

Go for it. :)

I can make a PR for the whole shootin' match.

I think I may have left one regressed test, though.

mkb commented 10 years ago

Ah, OK. I'm sure we can get the test sorted.

mkb commented 10 years ago

I've got a few of your changes merged to master and I'll do a 1.2 release on Monday. I want to confer with @wyhaines on the database.yml change so I don't mess up his production apps next time he updates.

orospakr commented 10 years ago

Awesome. Cheers!