How can I enforce a min number of nested attributes or associated records during creation of the Model. This works fine but the error message is shown at the top of the form (nested), I want it to appear inline or near the nested association fields.
Model Vote
has_many :vote_items, :dependent => :destroy
validate :min_vote_items, :if => :its_new?
accepts_nested_attributes_for :vote_items, :limit => 5, :allow_destroy => true, :reject_if => proc { |attrs| attrs[:option].blank? }
def min_vote_items
if self.vote_items.length < 2
errors.add_to_base("Please specify at least two vote options")
return false
end
end