I ran into an issue today that i was hoping you might be able to take a look at, I am trying to create entries, but the entry error responds with @messages={:credit_amounts=>["is invalid"], :debit_amounts=>["is invalid"]}> and the debit/credit amounts respond with an error of @messages={:entry=>["can't be blank"]}>. I am following the below order of operations:
ro = Organization.first
r= o.relationships[3]
rr= o.relationships[5]
acct = o.accounts[3]
accct = o.accounts[5]
debit_amount = rr.debit_amounts.new(amount: 1000, account: acct)
credit_amount = r.credit_amounts.new(amount: 1000, account: accct)
entry = o.entries.build(description: "testentry")
entry.debit_amounts << debit_amount
entry.credit_amounts << credit_amount
entry.save
if I am breaking the plutus setup by adding Relationships and Organizations, i was thinking maybe i can override these validations in the engine with a callback to allow one or the other to be created first, but i feel like that might be dangerous and cause issues with legitimate double entry practices? just a thought
can you provide any insight into why i might be getting this error, i dont see a way to create the entry without attaching the credit and debit amounts and the debit and credit amounts wont save until they have an entry associated with them, its a vicious circle :)
thanks for any assistance you can provide.
Brian