method

valid?

Importance_2
v3.0.0 - Show latest stable - 0 notes - Class: ActiveResource::Validations
valid?() public

Checks for errors on an object (i.e., is resource.errors empty?).

Runs all the specified local validations and returns true if no errors were added, otherwise false. Runs local validations (eg those on your Active Resource model), and also any errors returned from the remote system the last time we saved. Remote errors can only be cleared by trying to re-save the resource.

Examples

  my_person = Person.create(params[:person])
  my_person.valid?
  # => true

  my_person.errors.add('login', 'can not be empty') if my_person.login == ''
  my_person.valid?
  # => false
Show source
Register or log in to add new notes.