From: Florian Weber Date: 2004-07-11T20:57:54+09:00 Subject: Re: ActiveRecord comments hello! i might be wrong, but i think this would work: has_and_belongs_to_many :users, :class_name => "User" (you might also need to use the join_table option) ciao! florian On Jul 11, 2004, at 6:03 Uhr, Carl Youngblood wrote: > I'm trying out ActiveRecord for the first time and I have a > question/suggestion: > > I prefer not to pluralize my table names; it's pretty obvious that > they are going to hold more than one row, so why bother? So, in > ActiveRecord, I chose to turn off the default behavior with: > > ActiveRecord::Base.pluralize_table_names = false > > However, this makes it so I can't declare my objects' associations in > an intuitive way. For example, in the following code: > > class Email < ActiveRecord::Base > has_and_belongs_to_many :user > end > > I can no longer say has_and_belongs_to_many :users. I have to say > has_and_belongs_to_many :user. When adding multiple associations, I > also can't say someuser.add_emails. I have to say someuser.add_email, > even when I am adding more than one. Why can't I keep my table names > singular and yet refer to my associations in plural form? Since > ActiveRecord already understands plurals, it should be able to reverse > the process as well. > > Regardless, it is a great tool that I'm sure will be mighty handy. > > Thanks, > > Carl Youngblood > > >