method

add_to_base

Importance_1
v2.1.0 - Show latest stable - 0 notes - Class: ActiveResource::Errors
add_to_base(msg) public

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"]
Show source
Register or log in to add new notes.