Link_to and fragment identifiers


#1

Fragment identifiers, it took me 30 minutes just to figure out what
they are called.

I would like to be able to create url that looks like this:
post/view/id#comments

How do I do that with a link_to function?

link_to “Comments”, :controller => “post”, :action => “view”, :id =>
post.id ???

Thanks guys! :slight_smile:

John K.
http://www.kopanas.com

============================================================
http://www.soen.info - Index of online software engineering knowledge
http://www.cusec.net - Canadian University Software Engineering
Conference
http://www.soenlive.com - Presentations from CUSEC


#2

On Friday, May 26, 2006, at 7:50 PM, John K. wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

link_to “Comments”, :controller => “post”, :action => “view”, :id =>
post.id, :anchor=>‘comments’

_Kevin


#3

John K. wrote:

Fragment identifiers, it took me 30 minutes just to figure out what they
are called.

I would like to be able to create url that looks like this:
post/view/id#comments

How do I do that with a link_to function?

link_to “Comments”, :controller => “post”, :action => “view”, :id =>
post.id ???

Use :anchor, e.g.

link_to “Comments”,
:controller => “post”,
:action => “view”,
:id => post.id,
:anchor => “comments”


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby