Flowdock
method

valid?

Importance_2

Method deprecated or moved

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

These similar methods exist in v4.0.2:

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.