Al filtrar PostRelation devolver otra

This commit is contained in:
f 2020-10-01 09:17:04 -03:00
parent 4fea15dcfa
commit fb56ef2d74

View file

@ -115,6 +115,14 @@ class PostRelation < Array
end]
end
# Como Array#select devolviendo una relación
#
# @return [PostRelation]
alias array_select select
def select(&block)
PostRelation[*array_select(&block)]
end
# Intenta guardar todos y devuelve true si pudo
def save_all(validate: true)
map do |post|