Evan Weaver on 30 May 2007 02:50:57 -0000


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

Re: [PhillyOnRails] AR accessor problem

  • From: "Evan Weaver" <evan@cloudbur.st>
  • To: talk@phillyonrails.org
  • Subject: Re: [PhillyOnRails] AR accessor problem
  • Date: Tue, 29 May 2007 22:50:44 -0400
  • Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=ZfsJMgfkSRvk+iFKpuqQEZt1YNOfitdvsTmkS64LyUE72G7WvXrXM2DrvmCy9g6lP1sg25+ih/FU5jqNeeskkswE9b2fftIfM6BYnLFqIMEVP6wQdYneKeRXlxFV8gnkLz94A9MpKVGN3WKZhfxLrgijvf55mVBWBX8CJv0tEdM=
  • List-archive: <http://lists.phillyonrails.org/pipermail/talk>
  • Reply-to: talk@phillyonrails.org
  • Sender: talk-bounces@phillyonrails.org

Trying using:

self.cash = self.cash + tx.gain

or even

cash = self.cash + tx.gain

The syntax parser might be thinking "cash" is a local.

Evan

On 5/29/07, Cliff Moon <cliff@chariotsolutions.com> wrote:
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



--
Evan Weaver
Cloudburst, LLC
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk