Reputation: 70
I have two models InInvoice
, Disbursement
. Both are associated: InInvoice
optionally belongs_to disbursement
. Both have a has_one
attachment called att
.
InInvoice
is supposed to delegate att
calls to Disbursement
but only if att
is NOT present on the InInvoice
? (else the att
is used normally on the InInvoice
).
Optional delegation seems not to work which I thought about first.
Basically I am getting a "Step level to deep"/endless loop if I try to create a deviated method def att
which calls the attachment but via the method att
.
Basically what I think to need is a return value of the rails attachment in the method which doesn't use the method name itself. Is there something like: File.new(att_attribute)
which can be called in in the att
method?
Upvotes: 0
Views: 45