On 11 January 2012 11:07, Ahmy Yulrizka <[email protected]> wrote:
>
> Ahmy Yulrizka
>
>
> On Wed, Jan 11, 2012 at 1:43 AM, Loren <[email protected]> wrote:
>>
>> ...
>>    puts var_m * numb_m + var_d * numb_d + var_c * numb_c + var_l *
>> numb_l + var_x * numb_x + var_v * numb_v + var_i * numb_i
>
>
> this line interpret as var_i * nil
> hence that error
>
> simple solution is
>
> change it to :
>
> var_i * (numb_i || 0)
>
> that line actually mean :
>
> var_i * numb_i if numb_i is not nil
> else var_i * 0

Also have a look at the Rails Guide on debugging, that will show you
how to use ruby-debug to break into your code and inspect data, which
will help when you have similar issues again.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to