Hi --

On Fri, 20 Sep 2002, Matthew, Graeme wrote:

> Perhaps it is better to move away from the DBI fetch_hash method and go back
> to using hardcoded instance variables for example
>
> @projectCode = @data['prj_id']
> @projectName = @data['prj_name']
>
> def projectName=(val)
> 	@projectName = val if val
> 	return @projectName
> end
>
> ??

It looks like you're defining the instance variables in the wrong
scope.  If you do:

  class A
    @ivar = 1
    def thing
      puts @ivar   # nil
    end
  end

the i.v. @ivar is an instance variable of class A, not of instances of
class A.  You'd want to do something like:

  class A
    def initialize
      @ivar = 1
    end
    def thing
      puts @ivar   # 1
    end
  end


David

-- 
David Alan Black                      | Register for RubyConf 2002!
home: dblack / candle.superlink.net     | November 1-3
work: blackdav / shu.edu                | Seattle, WA, USA
Web:  http://pirate.shu.edu/~blackdav | http://www.rubyconf.com