aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index dee460d9c5..fe528f514c 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1410,8 +1410,8 @@ module ActiveRecord #:nodoc:
# Enables Active Record objects to be used as URL parameters in Action Pack automatically.
def to_param
- # can't use alias_method here, because method 'id' optimizes itself on the fly
- id
+ # 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
end
def id_before_type_cast #:nodoc: