method

add_to_base

rails latest stable - Class: ActiveRecord::Errors

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

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

stevo ยท Aug 13, 201010 thanks

use model_instance.errors[:base] << "Msg" instead of depracated model_instance.errors.add_to_base("Msg") for Rails 3