mirror of
https://github.com/github/rails.git
synced 2026-01-29 00:08:15 -05:00
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
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Minor tweak to improve performance of ActiveRecord::Base#to_param.
|
||||
|
||||
* Observers also watch subclasses created after they are declared. #5535 [daniels@pronto.com.au]
|
||||
|
||||
* Removed deprecated timestamps_gmt class methods. [Jeremy Kemper]
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user