New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specs for association options (and bug fixes) and Model.find(multiple pks) #132
Conversation
Hi Jacob :) Congrats on your first pull request (PR)!! Anyway, this PR will be just fine to comments on both commits. Multi Find FeatureIn 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 Associations BugsGood catch! 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!! 👍 |
I've pushed your associations fix on master, with an additional fix: the default primary_key for the has_many should not be the target's primary key, but the owner's primary key. |
9367ad0
to
8a88a4f
Compare
Hey @jh125486 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 V/r On Friday, May 22, 2015, Nicolas Viennot notifications@github.com 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 |
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.