我需要指定一个哈希以添加到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/

10-13 08:37