public Method

Errors.invalid?(attribute)

Returns true if the specified attribute has errors associated with it.

Examples

my_resource = Disk.find(1)
my_resource.errors.add('location', 'must be Main') unless my_resource.location == 'Main'
my_resource.errors.on('location')
# => 'must be Main!'

my_resource.errors.invalid?('location')
# => true
my_resource.errors.invalid?('name')
# => false

Source Code

# File active_resource/validations.rb, line 67
def invalid?(attribute)
  !@errors[attribute.to_s].nil?
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.