将 URL 参数传递给 redirect_to :root [英] Pass URL parameters to a redirect_to :root
问题描述
这可能是一个非常愚蠢的问题,但几乎不可能用谷歌搜索答案...
是否有可能(如果有的话如何...)执行以下操作:
redirect_to :root, :registered =>真的
然后链接到 http://myurl.com/?registered=true >
根 url 似乎删除了所有参数.我所需要的只是通过 Google Analytics 跟踪注册(我知道我可能应该将人们发送到感谢页面,但在这种特殊情况下 - 这样更有意义)
出于这个原因 - 我不想重定向到以下内容:
:controller =>:pages, :action =>:home, :registered =>真的
因为这会搞乱分析和搜索引擎优化等...
提前致谢.
你应该能够做到:
redirect_to root_path(:registered => "true")
This is probably a really dumb question, but it's virtually impossible to google the answer...
Is it possible (and if so how...) to do something like:
redirect_to :root, :registered => true
Which would then link to http://myurl.com/?registered=true
The root url seems to strip all params. All I need it for is to track sign-ups via Google Analytics (I know I should probably be sending people to a thank-you page instead, but in this particular case - it makes more sense this way)
For this reason too - I don't want to redirect to something like:
:controller => :pages, :action => :home, :registered => true
As this will mess up both the analytics and SEO etc...
Thanks in advance.
You should be able to do:
redirect_to root_path(:registered => "true")
这篇关于将 URL 参数传递给 redirect_to :root的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!