[rspec-users] Who is using NullDB?

Ben Mabey ben at benmabey.com
Mon Jan 12 19:22:29 EST 2009

On 1/12/09 4:20 PM, Avdi Grimm wrote:
> I gather from some recent posts that some people are actually using
> NullDB in their projects.  As the creator of NullDB, I'm pleased and a
> little surprised to hear this.
> Since NullDB is  has received exactly zero attention from me since
> it's initial release, I'm curious how it's working out for people.
> Do you use NullDB?
> If so, do you use my baseline version
> (http://svn.avdi.org/nulldb/trunk), or are you using a fork?
> If a fork, which fork, and why?
> Are there any bugs or feature requests you'd like to see addressed?
> Thanks,

Hey Avdi,
I love nullDB, so thank you very much for making it!  After looking into 
the various libs that disconnect AR from the DB I decided on nullDB due 
to it's design decisions.

I have been using your SVN version I believe.  Although, I may of 
grabbed it off of github a couple of times since that is easier for me.  
So my first request would be for you to add it to github so your fork 
can be the official one. :)  GitHub has an import from SVN feature which 
is really nice and makes it painless to convert a SVN repo.  If you do 
that I would be much more likely to fork it and submit patches.

There is one bug I have found that is quite annoying but I haven't 
looked into fixing it yet.  If I remember correctly the bug is something 
like this:

class Band < AR::Base
   has_many :members

#with nulldb:
band = Band.create!(:name => "Foo")
bar = Member.create!(:name => "Mr. Bar")
band.members << bar
band.members # => []

I understand the limitations of nullDB so I don't expect the above call 
to update the member's band_id.  I do however, expect the newly added 
member to appear in the AR association.   What I have found is that for 
some reason the above will not work when that is the first time the 
association is being used, but it will otherwise.  For example, this 
workaround works:

band = Band.create!(:name => "Foo")
bar = Member.create!(:name => "Mr. Bar")
band.members.inspect # workaround for odd nullDB bug
band.members << bar
band.members # => [bar]

Does that make sense?

Other than that bug, and the problem with the adapter changing slowing 
things down nullDB has been great. We are getting a lot of benefit from 
it on our current project.
So once again, thanks!


More information about the rspec-users mailing list