mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:11:42 +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)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue