gpt4 book ai didi

ruby-on-rails - Rails-将哈希添加到redirect_to

转载 作者:行者123 更新时间:2023-12-03 13:45:46 24 4
gpt4 key购买 nike

我需要指定一个哈希以添加到redirect_to。我该怎么做呢?

这是我的redirect_to的形成方式:

 redirect_to :action => 'show', :id => @consultant.id


我需要去example.com/consultant/#some_hash

谢谢!

最佳答案

尝试redirect_to your_current_options, :anchor => 'fragment_identifier'

http://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html#method-i-url_for

关于ruby-on-rails - Rails-将哈希添加到redirect_to,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4255922/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com