Slide 14
Slide 14 text
class Category < ActiveRecord::Base
has_many :categorizations
has_many :posts, :through => categorizations
end
class Categorization < ActiveRecord::Base
belongs_to :post
belongs_to :category
end
class Post < ActiveRecord::Base
has_many :categorizations
has_many :categories,
:through => categorizations
end
Monday, February 27, 12
Allows for validations, along with attaching data to the association. How about Users with
Ratings & Songs?