Cliff Moon on 30 May 2007 02:46:47 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] AR accessor problem


I'm trying to track down whether or not a problem I'm having is specific to the JRuby platform, or it's an inherent limitation of AR. What I'm trying to do is something like:

cash += tx.gain

where tx is another AR object and gain is a calculated field which isn't persistent. My unit tests keep telling me that I'm trying to call nil.+ at this line, despite cash having been explicitly set. Curiously, the problem occurs exactly the same when the code is:

cash = cash + tx.gain

The following work:

blah = cash + tx.gain
cash = blah

and

self[:cash] = cash + tx.gain

So anyone have a clue what's going on here? Is this just a quirk of AR that I've been lucky enough not to have run into until now, or mightn't this be something JRuby related?
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk