Something new undefined method

thanks hal, seem to have worked around it as follows:

return @data.nil? ? nil : @data[‘prj_id’]

Graeme Matthew
Analyst Programmer
Mercer Investment Consulting
Level 29, 101 Collins Street, Melbourne, VIC, 3001, Australia
Tel - 61 3 9245 5352 Fax - 61 3 9245 5330


-----Original Message-----
From: Hal E. Fulton []
Sent: Friday, 20 September 2002 13:42
Subject: Re: Something new undefined method

----- Original Message -----
From: “Matthew, Graeme”
To: “ruby-talk ML”
Sent: Thursday, September 19, 2002 10:15 PM
Subject: Something new undefined method

Here is one I have not encountered :

c:/dev/cgi-bin/Project.rb:29:in projectCode': undefined method[]’ for

undefined method but I cannot see a problem with this

def projectCode
return @data[‘prj_id’]

It’s a runtime error (the most common one I see).
Apparently @data has the value nil when you
try to apply [] to it…



This e-mail and any attachments may be confidential or legally privileged.
If you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return

Thank you for your cooperation.