Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

skip another Array is_a check

  • Loading branch information...
commit 6eeb76f0411e3d7d78b903601e15a7c7b61ed88b 1 parent f2fa291
@tenderlove tenderlove authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
View
10 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -111,12 +111,15 @@ def polymorphic_url(record_or_hash_or_array, options = {})
if record_or_hash_or_array.first.is_a?(ActionDispatch::Routing::RoutesProxy)
recipient = record_or_hash_or_array.shift
end
- args = record_or_hash_or_array.dup
+
+ args = record_or_hash_or_array.dup
+ record_list = record_or_hash_or_array.dup
else
- args = [record_or_hash_or_array]
+
+ args = [record_or_hash_or_array]
+ record_list = extract_record_list(record_or_hash_or_array)
end
- record_list = extract_record_list(record_or_hash_or_array)
record = convert_to_model(record_list.pop)
inflection = if options[:action] && options[:action].to_s == "new"
@@ -201,7 +204,6 @@ def build_named_route_call(records, record, inflection, options)
def extract_record_list(record_or_hash_or_array)
case record_or_hash_or_array
- when Array; record_or_hash_or_array
when Hash; [record_or_hash_or_array[:id]].compact
else [record_or_hash_or_array]
end
Please sign in to comment.
Something went wrong with that request. Please try again.