Ruby on Rails
|
|
||||||||||||
|
class Category < ActiveRecord::Base has_and_belongs_to_many :products end class Product < ActiveRecord::Base has_and_belongs_to_many :categories end #You can now use acategory.products #get all products with acategory aproduct.categories #yes, it pluralizes category correctly
7 of 16