From: TAKAHASHI Masayoshi Date: 2002-07-07T13:11:30+09:00 Subject: Re: Pre-RCR... nil.empty? Dave Thomas wrote: > Working with CGI forms and databases, it's something of a pain having > to do > > string = cgi['field'][0] > > if string.nil? || string.empty? > error "Please specify a value for 'field'" > end > > etc etc... string = cgi['field'][0].to_s or string.to_s.empty? is good (but not the best) way, I think. # We need something like CGI#get_value_as_string(key)? In generally (especially in database), NULL and empty string are not the same. So we should be careful to deal with nil. Regards, TAKAHASHI 'Maki' Masayoshi E-mail: maki@rubycolor.org "what is seen is empty, what is empty is seen." --- HAN NYA SHIN GYO (The Heart of Prajna Paramita Sutra)