提交 66313f77 编写于 作者: N Nicholas Seckar

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
上级 64b7c5fb
*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 @@ def id
# 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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册