I'm having trouble with validation. I want to require the user to select a category before a post is successfully created.
I'm using has_many :through for posts and categories as follows:
class Post < ActiveRecord::Base has_many :categorizations has_many :categories, :through => :categorizations end
class Categorization < ActiveRecord::Base belongs_to :category belongs_to :post end
class Category < ActiveRecord::Base has_many :categorizations has_many :posts, :through => :categorizations end
I've tried validates_presence_of :categorizations in the Post model, but the application simply saves it without verifying that the user selected a checkbox.
Any ideas what I can do?