5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:41:41 +00:00

Merge branch 'writable' into rails

This commit is contained in:
f 2021-04-21 10:19:57 -03:00
commit 56725f3bd7

View file

@ -348,6 +348,8 @@ class Post
def update_attributes(hashable)
hashable.to_hash.each do |attr, value|
next unless self[attr].writable?
self[attr].value = value
end
@ -378,9 +380,7 @@ class Post
# Ejecuta la acción de guardado en cada atributo.
def save_attributes!
attributes.select do |attr|
self[attr].writable?
end.map do |attr|
attributes.map do |attr|
self[attr].save
end.all?
end