Skip to content

Instantly share code, notes, and snippets.

View bighi's full-sized avatar

Leonardo Bighi bighi

View GitHub Profile
def merge(people)
people.each do |id|
person = Person.find(id)
return false unless person.account.id == self.account.id
self.transaction do
person.financial_transactions.each do |ft|
ft.person = self
errors[:base] << "Erro ao salvar financial transaction" unless ft.save!
end