not sure where you got the :condition from but try this
def accepted_accounttransactions accounttransactions.inject(0) {|total, at| total + (at.status == 'accepted' ? at.amount : 0 } end
not sure where you got the :condition from but try this
def accepted_accounttransactions accounttransactions.inject(0) {|total, at| total + (at.status == 'accepted' ? at.amount : 0 } end
try
def accepted_accounttransactions(filter) accounttransactions.inject(0) {|total, at| total + (at.status == filter ? at.amount : 0 } end
model.accepted_accounttransactions('accepted')