How to get the "#" symbol in the :id into the redirect_to method in Rails

Posted by Matthias Günther on Stack Overflow See other posts from Stack Overflow or by Matthias Günther
Published on 2010-05-25T05:24:44Z Indexed on 2010/05/25 5:31 UTC
Read the original article Hit count: 250

Filed under:

Hello,

this is a silly questions but I don't understand, why rails isn't evaluating my string as expected. Here is my problem:

I want to redirect to an url in the form ~/:controller/index/#_76

  redirect_to :action => "index", :id => '#_76'

But I'm getting the url in the form: ~/:controller/index/%25_76 and so my anchor for linking to a certain place in the website isn't working. Can someone please explain me, why rails makes this rendering? I think this hase something to do with url encoding.

Again thanks for your help, I'm learning every day a little bit more about rails :).

© Stack Overflow or respective owner

Related posts about ruby-on-rails