public Method

Errors.on_base

A method to return errors assigned to base object through add_to_base, which returns nil, if no errors are associated with the specified attribute, the error message if one error is associated with the specified attribute, or an array of error messages if more than one error is associated with the specified attribute.

Examples

my_account = Account.find(1)
my_account.errors.on_base
# => nil

my_account.errors.add_to_base("This account is frozen")
my_account.errors.on_base
# => "This account is frozen"

my_account.errors.add_to_base("This account has been closed")
my_account.errors.on_base
# => ["This account is frozen", "This account has been closed"]

Source Code

# File active_resource/validations.rb, line 112
def on_base
  on(:base)
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.