From 7b9964c2ad2945be417179bfd73e67a45a263664 Mon Sep 17 00:00:00 2001 From: Coraline Ada Ehmke + Aaron Patterson Date: Mon, 5 May 2014 16:51:58 -0700 Subject: small refactoring --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 0cc17f5cea..9b76e7d7b5 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -135,17 +135,13 @@ module ActionDispatch record = record_list.pop - inflection = nil - + inflection = :singular should_pop = true + if record.try(:persisted?) should_pop = false - inflection = :singular elsif options[:action] == 'new' - should_pop = true - inflection = :singular else - should_pop = true inflection = :plural end -- cgit v1.2.3