From: Dan Janowski Date: 2004-01-25T01:40:15+09:00 Subject: Re: cgi.rb params initialize_query() cgi params are always an array of values for a given key. A variety of accessors are both possible and practical. Allow me to explain: cgi['param'] returns the last value for param among get post and cookie (the 1.8 behavior is first instance, I think it should be last instance. This allows a form posted value to be easily used to override a query string value. Good since forms are typically used to get input from the client) cgi.params('param') an array of all values cgi.cookies('param') returning only cookies (not an array for param) cgi.params_get('param') an array of only gets cgi.params_post('param') an array of only posts params_get('param') is really just: @params.collect {|po| po if po.is_a? Get }.compact get and post vals should be Get < String and Post < String. This way a value gotten from cgi['param'] can be detected as post or get or cookie. On Jan 24, 2004, at 10:55 AM, Aredridel wrote: > On Sun, Jan 25, 2004 at 12:30:57AM +0900, Dan Janowski wrote: >> I assert that initialize_query is broken. CGI::parse should _always_ >> be >> called on the QUERY_STRING, no matter if the REQUEST_METHOD is POST or >> GET. > > Biggest problem: one would overwrite the other, unless your string-like > objects were used as keys and hashed differently depending on origin. > > Better to have separate arrays for get and post... ala modern PHP. > > Ari > >