0

I want to grab all the "additional" parameters from a URL and put them in a redirect_to. I won't know what the parameters are, though.

Example: example.com/books/1234?name=Bobby&uid=3819&gender=male

And I'd want to do something like redirect_to login_path(params)

And it would then redirect to example.com/login?name=Bobby&uid=3819&gender=male

I know I could pass :name, :uid and :gender in the redirect_to, but like I said, I won't know exactly what parameters will be there, so I just need to grab all of them.

1 Answer 1

2

I assume you just want to pass the GET parameters to this redirect. If so, you can do this:

redirect_to login_path(request.GET)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.