Distinguish options ivar from local; Extract latent Adapter::CachedSerializer

This commit is contained in:
Benjamin Fleischer
2015-09-16 22:12:13 -05:00
parent 3f0794bd39
commit 9d65f0adc5
10 changed files with 131 additions and 100 deletions

View File

@@ -26,7 +26,7 @@ module ActiveModel
raw_fields.inject({}) { |h, (k, v)| h[k.to_sym] = v.map(&:to_sym); h }
elsif raw_fields.is_a?(Array)
if root.nil?
raise ArgumentError, 'The root argument must be specified if the fields argument is an array.'
raise ArgumentError, 'The root argument must be specified if the fields argument is an array.'.freeze
end
hash = {}
hash[root.to_sym] = raw_fields.map(&:to_sym)