From: patrick-may@... (Patrick May) Date: 2002-07-09T06:44:57+09:00 Subject: Re: Pre-RCR... nil.empty? Dave Thomas wrote in message news:... > 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 This is related to the way cgi handles multiple parameters. Your first test, string.nil? is necessary b/c cgi['field'] returns an array, which may be empty. There was discussion starting from [ruby-talk: 39898]. In [ruby-talk: 39962], Wakou Aoyama made this (excellant) suggestion: > cgi.rb has undocumented method "CGI#param". > > cgi.param["name"] # == cgi.params["name"].join("\0") > > now : cgi["name"] == cgi.params["name"] > future?: cgi["name"] == cgi.param["name"] If Wakou changes to this, then I believe string.nil? will be unnecessary. ~ Patrick