Rails 5 has the relation now (closes #1)

This commit is contained in:
Tom Naessens 2019-05-30 21:39:53 +12:00
parent ac64fed6a8
commit 13bf57d132

View file

@ -32,7 +32,7 @@ class User < ActiveRecord::Base
scope :humans, -> { where.not(id: self.zeus) } scope :humans, -> { where.not(id: self.zeus) }
def transactions def transactions
Transaction.where("creditor_id = ? OR debtor_id = ?", id, id) Transaction.where('creditor_id = ?', id).or(Transaction.where('debtor_id = ?', id))
end end
def calculate_balance! def calculate_balance!