It wasn't entirely obvious (to me) how to achieve this in an ActiveRecord model - you need *both* of the following two lines:
validates_presence_of :category, :message => " must be specified" validates_associated :category
Hope this helps someone.
11397 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
validates_presence_of :category, :message => " must be specified" validates_associated :category
You need to create an account or log in to post comments to this site.