aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/conversion.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/conversion.rb')
-rw-r--r--activemodel/lib/active_model/conversion.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index 6b0a752566..0a19ef686d 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -62,7 +62,7 @@ module ActiveModel
# person = Person.create
# person.to_param # => "1"
def to_param
- persisted? ? to_key.join('-') : nil
+ (persisted? && key = to_key) ? key.join('-') : nil
end
# Returns a +string+ identifying the path associated with the object.