method

new?

new?()
public

A method to determine if the resource a \new object (i.e., it has not been POSTed to the remote service yet).

Examples

  not_new = Computer.create(:brand => 'Apple', :make => 'MacBook', :vendor => 'MacMall')
  not_new.new? # => false

  is_new = Computer.new(:brand => 'IBM', :make => 'Thinkpad', :vendor => 'IBM')
  is_new.new? # => true

  is_new.save
  is_new.new? # => false

2Notes

Method doesn't exists

rafaelrosafu · Dec 3, 20085 thanks

Don't confuse it with new_record? in ActiveRecord

Corrected link to ActiveRecord's "new_record?" method

gdelfino · Apr 20, 20094 thanks

rafaelrosafu, the correct tink to ActiveRecord's "new_record?" method is:

"http://apidock.com/rails/ActiveRecord/Base/new_record%3F"