lib/postable.rb in json_api_toolbox-2.0.0 vs lib/postable.rb in json_api_toolbox-2.0.1
- old
+ new
@@ -5,10 +5,10 @@
class << self
def normalize_post(hash, model)
associations = model.reflect_on_all_associations.map(&:name)
normalized_hash = hash.map do |key, value|
child_model = association_class(model, key) if value.is_a? Hash
- key = associations.include?(key.to_sym) ? "#{key}_attributes" : key
+ key = "#{key}_attributes" if associations.include?(key.to_sym)
hash_value = check_child_association(value, key, model, child_model)
[key, hash_value]
end
normalized_hash.to_h
end