mirror of
https://0xacab.org/sutty/sutty
synced 2025-01-20 05:13:39 +00:00
limpiar tambien los hashes
This commit is contained in:
parent
8406681469
commit
ae8856334c
1 changed files with 3 additions and 1 deletions
|
@ -199,7 +199,9 @@ class Post
|
||||||
# HashWithIndifferentAccess
|
# HashWithIndifferentAccess
|
||||||
attrs = attrs.to_h.map do |k,v|
|
attrs = attrs.to_h.map do |k,v|
|
||||||
t = template_fields.find { |t| t.key == k }
|
t = template_fields.find { |t| t.key == k }
|
||||||
v = v.values.map(&:to_h) if t && t.nested? && t.array?
|
if t && t.nested?
|
||||||
|
v = t.array? ? v.values.map(&:to_h) : v.to_h
|
||||||
|
end
|
||||||
{ k => v }
|
{ k => v }
|
||||||
end.reduce(Hash.new, :merge).stringify_keys
|
end.reduce(Hash.new, :merge).stringify_keys
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue