class Category < ActiveRecord::Base
 belongs_to :sector
 has_and_belongs_to_many :suppliers
 validates :sector, :name, :presence => true

As you see I have validates :sector, :presence => true.
When I create a new Category, if I don't select a sector I have an
error page with the message:

Couldn't find Sector with ID=

But there is the validates, why I don't have the message sector can't be blank?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to