27

I have a link_to method in Rails

link_to("feedback", meetings_url(:anchor => "sometext"))

=> The above code produces:

<a href="/p/meeting/?scroll_to=sometext">feedback</a>

I thought anchor was supposed to prepend a hash paramter, something like this:

/p/meeting/#sometext
Flip
  • 6,233
  • 7
  • 46
  • 75
Manjunath Manoharan
  • 4,567
  • 6
  • 28
  • 43

1 Answers1

44

I just tried in the console and I get the expected #anchor

include Rails.application.routes.url_helpers
# => Object
default_url_options[:host] = "localhost"
# => "localhost"
profiles_url(:anchor => "moo")
# => "http://localhost/profiles#moo"

What version of rails are you using? Do yo maybe have a gem or plugin that is overriding your link_to helper? You could create an empty rails app, and try the above test to see if something else is causing it.

Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
Jake Dempsey
  • 6,264
  • 1
  • 30
  • 25