在我的 webapp + 使用 Rails 7 中访问 URL 时如何重定向到外部 URL?
How to make a redirect to external URLs when visiting URLs in my webapp + Using Rails 7?
我正在通过建立工作委员会来学习 RoR。因此,当有人访问我的 Rails 工作的显示页面时,我试图重定向到外部 URL。我正在尝试执行以下逻辑,
Click on show page link -> Check if Description available
-> Yes (Then go to show page)
-> No (Then go to show page URL which then
automatically redirects to corresponding
External URL associated with the post)
在你的表演动作中,你可以使用这个方法
redirect_to 'https://whosebug.com', allow_other_host: true
阅读更多:https://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to
我正在通过建立工作委员会来学习 RoR。因此,当有人访问我的 Rails 工作的显示页面时,我试图重定向到外部 URL。我正在尝试执行以下逻辑,
Click on show page link -> Check if Description available
-> Yes (Then go to show page)
-> No (Then go to show page URL which then
automatically redirects to corresponding
External URL associated with the post)
在你的表演动作中,你可以使用这个方法
redirect_to 'https://whosebug.com', allow_other_host: true
阅读更多:https://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to