I'll look at the rest of your example later, but...

John Woods wrote:
> The plural model name comes from the Agile Development book. They have
> an example--categories_products, linking categories to products--which
> they turn into a model. Should it be renamed category_product?
[...]

If I had to choose one of those options, I'd probably use 
CategoryProduct and rename the table.  However, I think neither option 
is very good.  What most people here seem to recommend is this: when 
your join table becomes a model, take the time to come up with an 
appropriate name for it.

For example, in this case, we might go from Category habtm Products 
(with categories_products table) to

class Category
  has_many :categorizations
  has_many :products, :through => :categorizations
end

(likewise for Product)

class Categorization
  belongs_to :category
  belongs_to :product
end

Choosing an appropriate name for the join model will make future 
development much easier and clearer.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to