From: Pit Capitain Date: 2002-08-10T05:30:58+09:00 Subject: Re: Variable validation Hi Chris, just one minor bug in the code (see below) > Thanks for the replies - I used a bit of stuff from both and am doing > this: > > RequiredAttributes = [:loginName, :password, :firstName, > :lastName, > :nickName, :email] > > attr_accessor *RequiredAttributes > > def check_required > missing = '' > RequiredAttributes.each do |sym| > value = send(sym) > missing << ', ' if !missing.empty? the line above should be inside the following if > missing << sym.id2name if value == nil || value.empty? > end > > raise RequiredDataMissingError.new("Required fields not set: > #{missing}") if !missing.empty? > end Regards, Pit