method

add_to_base

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveResource::Errors

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

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.