method
add_to_base
v2.1.0 -
Show latest stable
- Class:
ActiveRecord::Errors
add_to_base(msg)public
Adds an error to the base object instead of any particular attribute. This is used to report errors that don’t tie to any specific attribute, but rather to the object as a whole. These error messages don’t get prepended with any field name when iterating with each_full, so they should be complete sentences.
1Note
add_to_base in Rails 3
use model_instance.errors[:base] << "Msg" instead of depracated model_instance.errors.add_to_base("Msg") for Rails 3