aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-06-05 15:41:24 +0000
committerJamis Buck <jamis@37signals.com>2006-06-05 15:41:24 +0000
commitf97978ad9137b7a9213fa9d4a58071ac6d23bc7e (patch)
treea713fe316f8828339dbe9805aa71e2620ae2759a /activerecord
parent149f5cad856f14b53780619a3efc0258cdd4759b (diff)
downloadrails-f97978ad9137b7a9213fa9d4a58071ac6d23bc7e.tar.gz
rails-f97978ad9137b7a9213fa9d4a58071ac6d23bc7e.tar.bz2
rails-f97978ad9137b7a9213fa9d4a58071ac6d23bc7e.zip
Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. (closes #5299)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4437 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 711cf130ac..b14fb50662 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)
+
* Refactored ActiveRecord::Base.to_xml to become a delegate for XmlSerializer, which restores sanity to the mega method. This refactoring also reinstates the opinions that type="string" is redundant and ugly and nil-differentiation is not a concern of serialization [DHH]
* Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [hcatlin@gmail.com]. Example:
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index c90e4d2162..dee460d9c5 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1409,7 +1409,10 @@ module ActiveRecord #:nodoc:
end
# Enables Active Record objects to be used as URL parameters in Action Pack automatically.
- alias_method :to_param, :id
+ def to_param
+ # can't use alias_method here, because method 'id' optimizes itself on the fly
+ id
+ end
def id_before_type_cast #:nodoc:
read_attribute_before_type_cast(self.class.primary_key)