mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 09:26:22 +00:00
Merge branch 'writable' into rails
This commit is contained in:
commit
56725f3bd7
1 changed files with 3 additions and 3 deletions
|
@ -348,6 +348,8 @@ class Post
|
||||||
|
|
||||||
def update_attributes(hashable)
|
def update_attributes(hashable)
|
||||||
hashable.to_hash.each do |attr, value|
|
hashable.to_hash.each do |attr, value|
|
||||||
|
next unless self[attr].writable?
|
||||||
|
|
||||||
self[attr].value = value
|
self[attr].value = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -378,9 +380,7 @@ class Post
|
||||||
|
|
||||||
# Ejecuta la acción de guardado en cada atributo.
|
# Ejecuta la acción de guardado en cada atributo.
|
||||||
def save_attributes!
|
def save_attributes!
|
||||||
attributes.select do |attr|
|
attributes.map do |attr|
|
||||||
self[attr].writable?
|
|
||||||
end.map do |attr|
|
|
||||||
self[attr].save
|
self[attr].save
|
||||||
end.all?
|
end.all?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue