On Mar 8, 3:17 pm, Gavin Kistner <[email protected]> wrote:
> On Mar 6, 2009, at 3:44 PM, Jeremy Evans wrote:
>
> > Also, note that belongs_to will be deprecated in the next version.
> > Use many_to_one.
>
> Really? That's a shame, IMHO.
> I know it's from AR, but that doesn't mean it's bad :)

I'm not removing it just because it is used by AR.  It was added by
the previous maintainer against my advice, simply to make conversion
easier for AR users.  I'm removing it because I think the method names
are bad.

> In my opinion, has_many, belongs_to, and even the verbose habtm are  
> all excellent names.
> "Book belongs_to :author". I can visualize that.
> "Author has_many :books". It is clear to me which table has the FK and  
> references the other.

I think belongs_to is stupid method name.  A book doesn't belong to an
author, as that implies ownership.  has_and_belongs_to_many is
probably the stupidest name, as it implies ownership both ways, which
generally makes no sense.  has_many isn't that bad, except even in a
many to many situation I think has_many would be just as descriptive,
which is why it's a bad idea to use it for just one association type.

> "Jorble one_to_many :bongle" (Or is it bongles?)
> I really, truly, not-lying-because-it-helps-my-argument, have no idea  
> which is the one and which is the many.

It's easy.  On on "MyModel.x_to_y :associated_model" call, the MyModel
is the x in the associatied_model is the y.  So for Jorble
one_to_many :bongles, Jorble is the one and bongles is the many.  If
the association method ends in many, you use the plural form,
otherwise, you use the singular form.  I suppose it is more natural if
you come from a database background, where people use terms like one
to many and many to one (or 1->N and N->1), and nobody uses terms like
belongs to to describe relationships between tables.

> I like my method calls (that  
> take arguments and do something, as opposed to accessors) to be verbs.  
> This isn't one, and I feel it. "Thing thing :thing". What?

I like my method calls to make sense.  Method calls should be verbs
only if they are actions.  Association methods are the way you
describe to Sequel how models are connected to each other.  There are
no actions, so I don't see a reason to use verbs.  You end up with bad
method names like has_and_belongs_to_many if you do that.

> It's an easy set of method aliases to make by myself, but I think you  
> should keep them. If anything, remove many_to_one and whatnot. :p

It is easy to keep them yourself, and that's the great thing about
ruby.  You don't have to agree with my choices, you are free to work
around them.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to