Topic: params GET values only

Hi everyone.

Im just wondering if there is a way to only retrieve the GET params for a request.

Essentually I just want to pass these on from one action (that handles a POST form) to another.  But of coarse I don't want the entire form in the URL.

Re: params GET values only

I'm not sure what you mean, a request is either a GET or POST, so the params are either only GET or only POST.  You can check to see if which method was used on the current request using request.method() or request.get? and request.post?.

Re: params GET values only

maybe its from my php days but I always think of GET params to be url based and POST params to be request header based.

So http://localhost/create/1?get_var_1=value1@get_var_2=value2

has GET values keys of get_var_1 and get_var_2

and POST vars are params that have been submitted in a post form.

Re: params GET values only

Try this:

get_params = request.path_parameters.merge(request.query_parameters)

Railscasts - Free Ruby on Rails Screencasts