Dear all,
I am currently confused with defining model in Rails that has two
has_many relationship.
I have a model that is called Category, and this model will be used by
two model which is Product and Blog.
Would this definition make sense in rails ?
Category
has_many :product
has_many :blog
Product
belongs_to :category
Blog
belongs_to :category
Or is there a better way to do it in Rails?
Thanks for the hint.
Dear all,
I am currently confused with defining model in Rails that has two
has_many relationship.
I have a model that is called Category, and this model will be used by
two model which is Product and Blog.
Would this definition make sense in rails ?
Category
has_many :product
has_many :blog
has_many indicates a plural ie it should be has_many :products.
Other than that from a pure rails point of view it makes sense but I
can't tell if what that expresses corresponds to what you want.
Fred