2013-07-10 22 views
1

我搜索了很長一段時間,令人驚訝的沒有結果。通過所有的URL參數在軌道上

如何通過redirect_to傳入傳入請求的所有URL參數?

我不知道是哪個PARAMS他們將是,因此它不能僅僅是正常的:this => that方式

例如,請求進入site.com?utm_source=test &的utm_content = Y & X = Y

但我不知道是什麼鍵都將是

我會做以下,但它包含了很多其他的則params的,我不希望在展示重定向後的URL

redirect_to :action => :new, :params => params

回答

2

看來答案是以下(僅適用於GET PARAMS)

redirect_to :action => :new, :params => request.query_parameters

對於post數據不僅可以使用

redirect_to :action => :new, :params => request.request_parameters