aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorYaroslav Markin <yaroslav@markin.net>2008-12-27 16:26:13 +0300
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-12-27 14:36:11 +0100
commit6e98adfc8e19a39fa45d4acd94145d318d151964 (patch)
tree014c82461f81ee3bdf42e1a5574cef92e96051a2 /activerecord/lib
parent4f043a48381c142e308824e3b7e15435a61bbb53 (diff)
downloadrails-6e98adfc8e19a39fa45d4acd94145d318d151964.tar.gz
rails-6e98adfc8e19a39fa45d4acd94145d318d151964.tar.bz2
rails-6e98adfc8e19a39fa45d4acd94145d318d151964.zip
ActiveRecord::Base#new_record? now returns false for existing records (was nil) [#1219 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 9746a46d47..80c109aea7 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2406,9 +2406,9 @@ module ActiveRecord #:nodoc:
write_attribute(self.class.primary_key, value)
end
- # Returns true if this object hasn't been saved yet -- that is, a record for the object doesn't exist yet.
+ # Returns true if this object hasn't been saved yet -- that is, a record for the object doesn't exist yet; otherwise, returns false.
def new_record?
- defined?(@new_record) && @new_record
+ (defined?(@new_record) && @new_record) || false
end
# :call-seq: