-
Notifications
You must be signed in to change notification settings - Fork 2
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
Many Association #22
base: master
Are you sure you want to change the base?
Many Association #22
Conversation
…tead of the first element
# | ||
def many(name, model, reference = to_reference) | ||
define_method name do | ||
return [] if self.id.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant self
detected.
I don't know if |
We have BTW remember this is not a relational DB, so there are a few differences on how we model our data. On |
Yes, that's true. But the same would apply to I would leave that desicion up to the user. You provide different alternatves with ork and he decides how to use them. For example I believe that for small, medium size apps, modeling relationships with secondary indexes is just fine. When index2i was released in 2011, the very same Basho was saying this: http://www.slideshare.net/rklophaus/querying-riak-just-got-easier-introducing-secondary-indices Maybe a small gem is the right place for this, like ork-hooks or the others. |
About the I'm sorry but I don't believe that I should merge this into |
@damiancaruso do not close this PR yet. I will reconsider this PR, when I come back from vacations. |
When you say the I would enable all the features using index2i when including a module as somebody might be using Ork with Bitcask backend. For example the current I'm working on You're right about links, I think is deprecated in Riak 2. |
This is basically the same as
referenced
but returning the Ork::ResultSet instead of the first element.Useful for one-to-many or many-to-many associations based on secondary indexes.