Permalink
Browse files

remove extract_record since we have extracted the list

  • Loading branch information...
tenderlove committed May 1, 2014
1 parent e937df3 commit a3b89261525f0c4caf72208117a8ab91ede676a0
Showing with 1 addition and 12 deletions.
  1. +1 −12 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -114,10 +114,8 @@ def polymorphic_url(record_or_hash_or_array, options = {})
record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1
end
- record = extract_record(record_or_hash_or_array)
- record = convert_to_model(record)
-
record_list = extract_record_list(record_or_hash_or_array)
+ record = convert_to_model(record_list.last)
args = Array === record_or_hash_or_array ?
record_or_hash_or_array.dup :
@@ -133,7 +131,6 @@ def polymorphic_url(record_or_hash_or_array, options = {})
args.pop
:plural
elsif record.is_a?(Hash)
- record_list = []
:singular
else
:singular
@@ -207,14 +204,6 @@ def build_named_route_call(records, record, inflection, options)
action_prefix(options) + route.join("_")
end
- def extract_record(record_or_hash_or_array)
- case record_or_hash_or_array
- when Array; record_or_hash_or_array.last
- when Hash; record_or_hash_or_array[:id]
- else record_or_hash_or_array
- end
- end
-
def extract_record_list(record_or_hash_or_array)
case record_or_hash_or_array
when Array; record_or_hash_or_array

0 comments on commit a3b8926

Please sign in to comment.