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.


  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
  that_guy.exists? # => false
Show source
Register or log in to add new notes.