I need to specify a hash to add to a redirect_to. How do I do this?
This is how my redirect_to is formed:
redirect_to :action => 'show', :id => @consultant.id
I need to go to example.com/consultant/#some_hash
Thanks!
Try redirect_to your_current_options, :anchor => 'fragment_identifier'
http://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html#method-i-url_for
I had a similar problem. I tried this:
redirect_to @post, anchor: 'tab_items'
but not worked using rails 4.2.6. But if I've changed to the following, and now works fine:
redirect_to post_path(@post, anchor: 'tab_items')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With