method

exists?

Importance_1
v3.0.0 - Show latest stable - 0 notes - Class: ActiveResource::Base
exists?() public

Evaluates to true if this resource is not new? and is found on the remote service. Using this method, you can check for resources that may have been deleted between the object’s instantiation and actions on it.

Examples

  Person.create(:name => 'Theodore Roosevelt')
  that_guy = Person.find(:first)
  that_guy.exists? # => true

  that_lady = Person.new(:name => 'Paul Bean')
  that_lady.exists? # => false

  guys_id = that_guy.id
  Person.delete(guys_id)
  that_guy.exists? # => false
Show source
Register or log in to add new notes.