From d94cd869c82bc52388b670553ee08ad34679fc42 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 6 May 2014 15:45:40 -0700 Subject: [PATCH] remove should_pop variable --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 192ab51db41f0..c3e9dde583315 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -133,11 +133,9 @@ def polymorphic_url(record_or_hash_or_array, options = {}) 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 @@ def polymorphic_url(record_or_hash_or_array, options = {}) 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