diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-17 11:31:08 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-17 11:31:15 -0800 |
commit | 5008d33eee4767cd84b1087ceec827f1eaec90d0 (patch) | |
tree | b8c9362eb8465df4f2f3af8ad132cc2fc259695e /actionpack | |
parent | e22885f3a9476990c07235512f5579740eec059b (diff) | |
download | rails-5008d33eee4767cd84b1087ceec827f1eaec90d0.tar.gz rails-5008d33eee4767cd84b1087ceec827f1eaec90d0.tar.bz2 rails-5008d33eee4767cd84b1087ceec827f1eaec90d0.zip |
dry up case / when statement
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 49e237f8db..82c4fadb50 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -99,11 +99,9 @@ module ActionDispatch record = extract_record(record_or_hash_or_array) record = record.to_model if record.respond_to?(:to_model) - args = case record_or_hash_or_array - when Hash; [ record_or_hash_or_array ] - when Array; record_or_hash_or_array.dup - else [ record_or_hash_or_array ] - end + args = Array === record_or_hash_or_array ? + record_or_hash_or_array.dup : + [ record_or_hash_or_array ] inflection = if options[:action] && options[:action].to_s == "new" args.pop |