aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/topic.rb
diff options
context:
space:
mode:
authorDavid Chelimsky <dchelimsky@gmail.com>2010-11-07 08:05:18 -0600
committerSantiago Pastorino <santiago@wyeworks.com>2010-11-09 13:54:04 -0200
commit1f06652a57e727700c3a673dc1f86e3b1e07ce1f (patch)
tree6ab5165939c2fcae615bd586ea0254e352f6715a /activerecord/test/models/topic.rb
parentf57b5197b3215d9dd66196e960ef5d78b7a62de1 (diff)
downloadrails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.gz
rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.bz2
rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.zip
use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test/models/topic.rb')
-rw-r--r--activerecord/test/models/topic.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 82d4b5997f..6496f36f7e 100644
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -89,7 +89,7 @@ class Topic < ActiveRecord::Base
end
def set_email_address
- if self.new_record?
+ unless self.persisted?
self.author_email_address = 'test@test.com'
end
end