in my user_helper.rb
def registration_form
content_for(:ready) do
“window.location = window.location.href +
‘#register_form’;”
end
end
in my new.html.haml view
- registration_form
first pass (correct)
http://localhost:3000/en_GB/signup#register_form
subsequent pass ( incorrect … but normal as per the js code)
http://localhost:3000/en_GB/signup#register_form%23register_form
how should I modify the js code to avoid repetition of the anchor, in
Ruby I would write that …
"… unless window.location.href already contains ‘#register_form’ "
" … window.location = window.location.href + ‘#register_form’ "
" … end
but in .js is there any equivalent ?
thanks for your feedback