Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Specs for association options (and bug fixes) and Model.find(multiple pks) #132
Sorry both these commits are in one pull request, it's my first time with git in a team environment.
I was converting over a Rails app to use rethinkdb and the belongs_to/has_many association options were not working as I expected. I think I fixed where the problems were and wrote tests to support.
After that I tried to pass an array to Model.find() and tracked down where that failed. I used the AR find method as a example for all the cases.
Also it's my first time using rspec, so if the syntax isn't right or something please send me on the right path.
Hi Jacob :)
Congrats on your first pull request (PR)!!
Anyway, this PR will be just fine to comments on both commits.
Multi Find Feature
In terms of API, we do something like:
class User include NoBrainer::Document field :id, :primary_key => true, :type => Array end User.create(:id => [1,2]) User.find([1,2])
It's a little hard to know without looking at the type of the primary key (which we may know nothing about if the type is set to be Object), to know if we are operating in the single pk case, or multi pks case.
So I think that the multi find feature should go in a separate method, like
Does this sound good to you?
btw, in your implementation, you should add
Regarding the rspec stuff:
All-in-all, what I am doing with rethinkdb is probably not the best use case, but I coming from clustering other DBs, it's seems pretty awesome. So I may not eventually use it (my coworker is testing out Cassandra, and I'll be testing Couchbase soon), but I'm happy to contribute.
let me quickly reply:
I've been grepping on gitlabhq, diaspora, and discourse, 3 major rails apps. Turns out
Regarding using rethinkdb, it's not an easy decision. But clustering postgresql properly is not really something you do easily. And rethinkdb has interesting features of its own.
Using nobrainer to give rethinkdb a feel of a relational DB can be seen as a bit weird.
Thank you for your contributions, very much appreciated!!
There's a bit of a problem with the
What's your take on the issue?
Looking through active record source, the rails core is creating a
On Friday, May 22, 2015, Nicolas Viennot firstname.lastname@example.org wrote:
Sent from my iPhone
With active record, you can declare a
With NoBrainer, we raise much sooner because we need to know the primary key name of the