Render to an anchor?

Simple problem, I want to render a .rhtml file and have it jump to an
anchor. Something like:

http://localhost:3000/convs/show/170#conv-170-6887

Tried borrowing the URL_FOR style:

render :action => show, :anchor => “conv-170-6887”

But that didn’t work.

Thanks in advance.

Brittain wrote:

Simple problem, I want to render a .rhtml file and have it jump to an
anchor. Something like:

http://localhost:3000/convs/show/170#conv-170-6887

Tried borrowing the URL_FOR style:

render :action => show, :anchor => “conv-170-6887”

But that didn’t work.

Thanks in advance.

Since an anchor is really a browser convention to jump to somewhere on
the page, you’ll need to use redirect_to in order to put the anchor in
the browser’s address bar:

redirect_to :action => show, :anchor => “conv-170-6887”

What other solution is posible intead of using redirect_to?

I’m having a similar problem while using redirect_to, the
error_messages_for does not persist.

I need to use render :action , :anchor

Maybe something like:

render :rjs => “Effect.ScrollTo(‘anchor’)”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs