Permalink
Browse files

remove should_pop variable

  • Loading branch information...
1 parent ad31afe commit d94cd869c82bc52388b670553ee08ad34679fc42 @tenderlove tenderlove committed May 6, 2014
Showing with 1 addition and 4 deletions.
  1. +1 −4 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
View
5 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

0 comments on commit d94cd86

Please sign in to comment.