Contact.errors.add(some_contact_field, ''some message'')
Go to http://api.rubyonrails.com
Look at ActiveRecord::Errors and ActiveRecord::Validations
This should send you on your way.
James Edward Gray II wrote:> One last question, then I promise to be quiet for the rest of the
> night! :)
>
> I''ve added a Company field to ContactsController#new. When the
process
> reaches ContactsController#create, I check to see if the Company already
> exists. If it does, I want to send the process back to
> ContactsController#new with an error message that will be picked up by
> error_messages_for ''contact''.
>
> My question is, how do I set my own error messages on an object?
>
> Thanks again.
>
> James Edward Gray II
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails