aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/polymorphic_routes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/polymorphic_routes.rb')
-rw-r--r--actionpack/lib/action_controller/polymorphic_routes.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb
index d6c57d1207..18dc1bd72f 100644
--- a/actionpack/lib/action_controller/polymorphic_routes.rb
+++ b/actionpack/lib/action_controller/polymorphic_routes.rb
@@ -4,21 +4,20 @@ module ActionController
record = extract_record(record_or_hash_or_array)
args = case record_or_hash_or_array
- when Hash: [record_or_hash_or_array[:id]]
+ when Hash: [ record_or_hash_or_array ]
when Array: record_or_hash_or_array.dup
- else [record_or_hash_or_array]
- end
-
- args.pop # Remove the base record; we only need it in one case
+ else [ record_or_hash_or_array ]
+ end
inflection =
case
when options[:action] == "new"
+ args.pop
:singular
when record.respond_to?(:new_record?) && record.new_record?
+ args.pop
:plural
else
- args.push(record) # Put the base record back in
:singular
end