diff --git a/app/models/post.rb b/app/models/post.rb index 0123a80..a0e1670 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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