method

add

add(attribute, msg)
public

Adds an error to an Active Resource object’s attribute (named for the attribute parameter) with the error message in msg.

Examples

  my_resource = Node.find(1)
  my_resource.errors.add('name', 'can not be "base"') if my_resource.name == 'base'
  my_resource.errors.on('name')
  # => 'can not be "base"!'

  my_resource.errors.add('desc', 'can not be blank') if my_resource.desc == ''
  my_resource.valid?
  # => false
  my_resource.errors.on('desc')
  # => 'can not be blank!'