From 66313f77ca20f563b824ca4d89d182aeaf30ea42 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Mon, 3 Jul 2006 03:57:31 +0000 Subject: 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 --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') 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: -- cgit v1.2.3