aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/polymorphic_routes.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
index 192ab51db4..c3e9dde583 100644
--- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
+++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -133,11 +133,9 @@ module ActionDispatch
end
inflection = lambda { |name| name.singular_route_key }
- should_pop = true
if options[:action] == 'new'
elsif record.try(:persisted?)
- should_pop = false
else
inflection = lambda { |name| name.route_key }
end
@@ -162,10 +160,9 @@ module ActionDispatch
when Symbol, String
record.to_s
when Class
- args << record unless should_pop
inflection.call record.model_name
else
- args << record.to_model unless should_pop
+ args << record.to_model if record.persisted?
inflection.call record.to_model.class.model_name
end