aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-07-03 03:57:31 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-07-03 03:57:31 +0000
commit66313f77ca20f563b824ca4d89d182aeaf30ea42 (patch)
tree6d179ec67013a8b20991fcd10ab67cb9b55b7187 /activerecord/lib/active_record
parent64b7c5fbd19323e02e0e3f58f6d4310d13b9a114 (diff)
downloadrails-66313f77ca20f563b824ca4d89d182aeaf30ea42.tar.gz
rails-66313f77ca20f563b824ca4d89d182aeaf30ea42.tar.bz2
rails-66313f77ca20f563b824ca4d89d182aeaf30ea42.zip
Minor tweak to improve performance of ActiveRecord::Base#to_param
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4531 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 5aeb8eb3a1..812f30c773 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1441,7 +1441,7 @@ module ActiveRecord #:nodoc:
# Enables Active Record objects to be used as URL parameters in Action Pack automatically.
def to_param
# We can't use alias_method here, because method 'id' optimizes itself on the fly.
- id.to_s if id # Be sure to stringify the id for routes
+ (id = self.id) ? id.to_s : nil # Be sure to stringify the id for routes
end
def id_before_type_cast #:nodoc: