Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoid calling extract_record multiple times

  • Loading branch information...
commit 876155705b56e66a8b9ed96f7b79d1c8d1763200 1 parent f1c0358
@tenderlove tenderlove authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
View
5 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -132,7 +132,7 @@ def polymorphic_url(record_or_hash_or_array, options = {})
end
args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
- named_route = build_named_route_call(record_or_hash_or_array, inflection, options)
+ named_route = build_named_route_call(record_or_hash_or_array, record, inflection, options)
url_options = options.except(:action, :routing_type)
unless url_options.empty?
@@ -175,7 +175,7 @@ def routing_type(options)
options[:routing_type] || :url
end
- def build_named_route_call(records, inflection, options = {})
+ def build_named_route_call(records, record, inflection, options = {})
if records.is_a?(Array)
record = records.pop
route = records.map do |parent|
@@ -186,7 +186,6 @@ def build_named_route_call(records, inflection, options = {})
end
end
else
- record = extract_record(records)
route = []
end
Please sign in to comment.
Something went wrong with that request. Please try again.