lib/nova/api/utils/base_struct.rb in nova-api-0.6.0 vs lib/nova/api/utils/base_struct.rb in nova-api-0.7.0

- old
+ new

@@ -17,16 +17,20 @@ self.class.const_get('ALLOWED_ATTRIBUTES').each do |key| next unless attributes.keys.include? key value = attributes[key] - data[key.to_sym] = value.is_a?(Array) ? value.map { |attribute| permit_value(key, attribute) } : permit_value(key, value) + data[key.to_sym] = extract_value(key, value) end data end private + + def extract_value(key, value) + value.is_a?(Array) ? value.map { |attribute| permit_value(key, attribute) } : permit_value(key, value) + end def permit_value(key, value) value.respond_to?(:allowed_attributes) ? value.allowed_attributes : value end end