TypeError: nil can't be coerced into Fixnum (on the line with the addition)

Why?

After a little more debugging, it is clear that 'quantity' is nil. How could that happen?

The answer lies in the fact that Ruby requires an explicit self reference when using attribute writers (aka, property setters) within the class itself. This feels clunky to me, but for your information, here's a rationalisation of the explicit self requirement.

So, in case you're wondering, what happened above is that the 'if' line created a nil local variable called 'quantity'! This local variable then had higher scope precedence than the class attribute with the same name. The addition line was then using the local 'quantity' rather than the class attribute and hence failed with the nil error.

44 comments:

I was thinking of looking up some of them newspaper websites, but am glad I came here instead. Although glad is not quite the right word… let me just say I needed this after the incessant chatter in the media, and am grateful to you for articulating something many of us are feeling - even from distant shores. Feel free to check out my site fashion accessory when you got time.

You may have not intended to do so, but I think you have managed to express the state of mind that a lot of people are in. The sense of wanting to help, but not knowing how or where, is something a lot of us are going through. I would love some feedback on my site garden supply when you got time.

I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Directory San Diego City when you got time.

I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Dallas Business Directory when you got time.

. Since I’m new to blogging, these articles are greatly appreciated; very useful and informative blog and every body must visit this blog. Please come visit my site Texas TX Phone Directory when you got time

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site Memphis Business Directory Forum Blog Classifieds when you got time.

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site City Guide Memphis when you got time.

Y te vi bailar bajo la lluviay saltar sobre un charco de estrellasObama Is Lying<1>When was the last time the MSM took a Republican's side in a fight over credibility with a Democratic opponent?Microsoft OfficeOffice 2010Well, it has been a while.Microsoft Office 2010However, conservatives have little to grumble about in the recent Office 2007face-off between Barack Obama and John McCain over McCain's statement thatte vi bailar bajo la lluviaesperando la luna llenaVolverás a reírte de verasMicrosoft Office 2007troops might have to remain for "100 years" in Iraq "as long as Americans are not being injured or harmed or wounded or killed" afterOffice 2010 keyfighting had concluded, Office 2010 downloadMost recently, ABC's Jake Tapper noted that at least on three occasions Obama had personally said that McCain favored cuando creas que estaba perdidovolverás a reírte de verascontinued fighting in Office 2010 ProfessionalIraq for 100 years. Tapper concluded that "Obama has in the past distorted McCain's comments" and "that he is violating his own stated si te quedas conmigoTe vi bailar bajo la lluviaesperando la luna llente vi llorar bajo la lunMicrosoft outlookaspirations...[b]ecause not only has he distorted what McCain said, he is not being honest about having made those distortions."Outlook 2010Tapper is not the only MSM reporter to point this out, Windows 7of course. It is not every day that the RNC sends around e-mail blasts quoting Frank Microsoft outlook 2010Rich ("Barack Obama and Hillary Clinton should be ashamed of themselves for libeling John McCain") and reports from the Chicago Tribune,

All those sequels will be fed to Starz as part of the new distribution deal. Other Weinstein Co. films coming to Starz include critically acclaimed "The King's Speech," and "Blue Valentine." nice and cheap ugg boots is on display right now at Harrods ugg clearance in London, but once released, will there be a market for it? The new green luxury car gives the environmentally conscious executive cheap uggs clearance the option of powering the CT 200H by either electricity orjordan basketball shoes by regular petrol. Lexusugg women is banking on the belief that there is a growing demand for a greenJordan Fusions. vehicle in the luxury car market.

For this reason players have a tendency to be tempted to get Gold WOW through safe web internet sites. Unless you will be an achieved player, accumulating the Gold for WOW you will need could possibly be a frustrating procedure.

I was thinking of looking up some of them newspaper websites, but am glad I came here cambridge batchel instead. Although glad is not quite the right word… let me just say I needed this after the incessant chatter in the media, and am grateful to you for articulating something many of us are feeling pink cambridge satchel- even from distant shores.

So, in situation you are wondering,Cheap RS Gold what took place previously is the fact that 'if' level developed a nil neighborhood varying called 'quantity'! This neighborhood varying then experienced higher scope precedence compared to course attribute using the specific same name. The inclusion level was then employing the neighborhood 'quantity' as opposed to the course attribute and therefore failed Sell Runescape Goldusing the nil error.

Additional tones are utilized simply because these types of colours tend to be ideal for official events for example graduating, as well as these types of can function like a celebration colour as well. The actual designs for example teas duration drink gowns along with stunning necklines as well as beautiful drops could be a couple of options for your own graduating gowns Alfred Angelo. Because these types of possess official as well as informal designs come up with, they may be an ideal options in order to move on within! To place more styles before you decide to, we now have put together a few info comparable within the sentences beneath. Have a look as well as help to make your decision.

You'll be able for the handles to be on major or on the facets. One aspect bracket can come within bathroom sink faucets deigns. Are probably the largest article will surely have 2 corner grips whilst the centerset comes with a lever tackle that's connected to the sink, and also the link touch can led faucet be a one piece light fixture that really needs a couple of slots.