aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/lib/active_resource')
-rw-r--r--activeresource/lib/active_resource/base.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 9fb347d2c3..b1a79731b9 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -550,6 +550,11 @@ module ActiveResource
attributes[self.class.primary_key] = id
end
+ # Allows ActiveResource objects to be used as parameters in ActionPack URL generation.
+ def to_param
+ id && id.to_s
+ end
+
# Test for equality. Resource are equal if and only if +other+ is the same object or
# is an instance of the same class, is not +new?+, and has the same +id+.
#