Hi, I'm new to ruby on rails. So i think i have association problems.
Given the three model classes with their associations:
class User < ActiveRecord::Base
has_many :products, :through=>:product_groups
class ProductGroup < ActiveRecord::Base
class Product < ActiveRecord::Base
So when i trying add new product. I get errors.
@product = current_user.product_groups.products.build
The error I'm receiving is:
NoMethodError (undefined method `products' for #<Class:0x2ca50b0>):
I'm confused, can anybody help me?