public Method

Errors.add_to_base(msg)

Add an error to the base Active Resource object rather than an attribute.

Examples

my_folder = Folder.find(1)
my_folder.errors.add_to_base("You can't edit an existing folder")
my_folder.errors.on_base
# => "You can't edit an existing folder"

my_folder.errors.add_to_base("This folder has been tagged as frozen")
my_folder.valid?
# => false
my_folder.errors.on_base
# => ["You can't edit an existing folder", "This folder has been tagged as frozen"]

Source Code

# File active_resource/validations.rb, line 31
def add_to_base(msg)
  add(:base, msg)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.