As written, there's no direct way to do this association in Rails. But
wouldn't it be sufficient to use a plain has_many :products in
Catalog? You've got a corresponding belongs_to in Product...
--Matt Jones
On Jul 9, 6:42 pm, slava <
mikerin.sl...@...> wrote:
> Here is my setup:
>
> class Product < ActiveRecord::Base
> belongs_to :catalog
> has_and_belongs_to_many :product_groups
> end
>
> class ProductGroup < ActiveRecord::Base
> belongs_to :catalog
> has_and_belongs_to_many :products
> end
>
> class Catalog < ActiveRecord::Base
> has_many :product_groups
> has_many :products, :through => :product_groups
> end
>
> I get:
> Invalid source reflection macro :has_and_belongs_to_many for
> has_many :products, :through => :product_groups. Use :source to
> specify the source reflection.
>
> ----------
> I have seen a few threads with posts asking this question, but found
> no suitable solution or workaround..
> any ideas please.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk@...
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@...
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en-~----------~----~----~----~------~----~------~--~---