Skip to content

Commit

Permalink
remove should_pop variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 12, 2014
1 parent ad31afe commit d94cd86
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
Expand Up @@ -133,11 +133,9 @@ def polymorphic_url(record_or_hash_or_array, options = {})
end end


inflection = lambda { |name| name.singular_route_key } inflection = lambda { |name| name.singular_route_key }
should_pop = true


if options[:action] == 'new' if options[:action] == 'new'
elsif record.try(:persisted?) elsif record.try(:persisted?)
should_pop = false
else else
inflection = lambda { |name| name.route_key } inflection = lambda { |name| name.route_key }
end end
Expand All @@ -162,10 +160,9 @@ def polymorphic_url(record_or_hash_or_array, options = {})
when Symbol, String when Symbol, String
record.to_s record.to_s
when Class when Class
args << record unless should_pop
inflection.call record.model_name inflection.call record.model_name
else else
args << record.to_model unless should_pop args << record.to_model if record.persisted?
inflection.call record.to_model.class.model_name inflection.call record.to_model.class.model_name
end end


Expand Down

0 comments on commit d94cd86

Please sign in to comment.