got the answer from js guru ..

use  =>   window.location.href.indexOf('#register_form') == -1

On 29 mai, 16:05, Erwin <yves_duf...@mac.com> wrote:
> 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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to