Closed coreyjewett closed 12 years ago
I think this feature should be pulled
No.
I object to the method name #parent(). It is not accurately descriptive of the relation.
Yeah, but javascript isn't English either. I think "parent" is somewhat appropriate because you're specifying the parent of your node (now a child).
If I were to suggest a namechange, I'd go with this.childOf('Author')
.
I would be agreeable to childOf I never liked belongs_to.
My suggestion for pulling the feature was in the context of #childOf modeling only one variety of relationship. At least with a renaming we're reducing the need for future API changes if this fleshes out more.
yes?
has_many, belongs_to { thru: 'some-model' } and more complex relational algebra isn't going to be implemented across the board.
Implementing only parent
, child
, all
and find
is enough to get by anywhere. If you're using something more SQL like, the engine should extend the Resource prototype with whatever methods necessary.
Was just reading wiki on Hierarchy relationships. Cool.
I object to the method name #parent(). It is not accurately descriptive of the relation. In the Shakespeare example given the method should be #belongs_to (keep reading, this isn't right either). As in:
There is a #has_many implicit in the current implementation that perhaps should be explicit:
Finally, since I'm picking on this example, I'm not sure #belongs_to is appropriate because a book can have multiple Authors.
I think this feature should be pulled (or at least renamed from #parent to #has_many) until some of the magic is stripped out and it follows relation modeling and terminology. Ruby on Rails' ActiveRecord might be a good case study for this.