mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
dry up case / when statement
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user