Good resource for the history of activerecord association method naming?

Someone asked me about the history of the method naming in activerecord and I wasn’t sure where to point them. For example, there was early criticism noted of has_and_belongs_to_many in this old post from 2005:
http://hans.fugal.net/blog/2005/10/03/habtm/

I was mentioning that many_to_many is not used because there are a few different ways of doing that via has_many :through and has_and_belongs_to_many, and to me belongs_to seems reasonable since it is a model associated with a child table that has a foreign key to a parent table, however that could have been foreign_key_to or similar to eliminate confusion, I guess, though maybe that makes the name less flexible and more tied to relational DB terms? Maybe having some aliases would make sense, I don’t know. I’m kind of used to it all now, but maybe there is some way it could all be clearer.

Does anyone have links to discussions or pages where the history of association naming was discussed for those that think it doesn’t make any sense and want a better explanation as to why associative methods are named as they are? Thanks.

Sorry, to be clear I meant those are two different ways of specifying that an instance of a model’s attribute can have many of some other model instance.

Several observations:

  1. You’re supposed to read them with the model name. So “a Post belongs_to an User” and “an User has_many Subscriptions”. These two makes a lot of sense most of the time and reads very naturally, which seems consistent among the nicer part of Ruby/Rails syntax (an object.is_a? type, do xyz unless condition.)

  2. Granted, has_and_belongs_to_many probably makes less sense if you look at that on its own. But given the two names we have above it is very easy to understand what this means. has_many is the “n” side of a 1-n, and belongs_to is the “1” side, so has_and_belongs_to_many naturally means the “n” side of n-n. And really, “a User has_and_belongs_to_many Groups” is not really so bad.

  3. This has been around for as long as I could tell. It predates the first public commit on svn and the rails website. So it’s quite likely that “discussions” doesn’t even apply here as it probably existed when Rails is still DHH’s pet project.

  4. Naming is hard. It is one of those things where you just have to make some decision and then move on to other more important things in life.

Does anyone have links to discussions or pages where the history of association naming was discussed for those that think it doesn’t make any sense and want a better explanation as to why associative methods are named as they are?

Basically all of those associations were present in rails before there even was a mailing list. You’d have to rummage around the git history to see if they were all done before there was any outside assistance, but I suspect the conversations you’re looking for were all in DHH’s head :wink:

Somehow this didn’t go through the first time