method
new?
v3.2.1 -
Show latest stable
-
2 notes -
Class: ActiveResource::Base
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3 (0)
- 2.1.0 (-1)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (-3)
- 3.0.9 (-2)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
new?()
public
Returns true if this object hasn’t yet been saved, otherwise, returns false.
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
Register or
log in
to add new notes.
rafaelrosafu -
December 3, 2008 - (v2.2.1)
5 thanks
Method doesn't exists
Don’t confuse it with new_record? in ActiveRecord
gdelfino -
April 21, 2009
4 thanks
Corrected link to ActiveRecord's "new_record?" method
rafaelrosafu, the correct tink to ActiveRecord’s “new_record?” method is:
"http://apidock.com/rails/ActiveRecord/Base/new_record%3F"