diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-01 14:36:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-12 15:54:42 -0700 |
commit | 42d6700b7cfe9e6beb935d31597ad8b3762d9ee2 (patch) | |
tree | 5938d9071cfa10db6a6f6a771f6f93b416cfbde7 /actionpack/lib | |
parent | a3b89261525f0c4caf72208117a8ab91ede676a0 (diff) | |
download | rails-42d6700b7cfe9e6beb935d31597ad8b3762d9ee2.tar.gz rails-42d6700b7cfe9e6beb935d31597ad8b3762d9ee2.tar.bz2 rails-42d6700b7cfe9e6beb935d31597ad8b3762d9ee2.zip |
stop popping in build_named_route_call
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 4d83b48ad1..afd971e7a5 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -114,13 +114,13 @@ module ActionDispatch record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 end - 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 : [ record_or_hash_or_array ] + 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" args.pop :singular @@ -195,7 +195,6 @@ module ActionDispatch end def build_named_route_call(records, record, inflection, options) - records.pop route = records.map { |parent| build_route_part parent, :singular } route << build_route_part(record, inflection) |