diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-30 15:32:57 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-30 15:32:57 -0700 |
commit | 876155705b56e66a8b9ed96f7b79d1c8d1763200 (patch) | |
tree | c0ee4f45ed2c5d879f643e66efcbf2a450363e55 | |
parent | f1c0358ee752252e4910eeb256d146aeee28ba5d (diff) | |
download | rails-876155705b56e66a8b9ed96f7b79d1c8d1763200.tar.gz rails-876155705b56e66a8b9ed96f7b79d1c8d1763200.tar.bz2 rails-876155705b56e66a8b9ed96f7b79d1c8d1763200.zip |
avoid calling extract_record multiple times
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 37f291a960..cfd33d1f31 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -132,7 +132,7 @@ module ActionDispatch 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 @@ module ActionDispatch 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 @@ module ActionDispatch end end else - record = extract_record(records) route = [] end |