# Problema link interni

**URL:** <https://www.ruby-forum.com/t/problema-link-interni/134670>\
**Category:** IT\
**Created:** [April 13, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/problema-link-interni/134670 "2008-04-13T20:00:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mckracken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@mckracken](https://www.ruby-forum.com/u/mckracken)\
**Post date:** [April 13, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/problema-link-interni/134670/1 "2008-04-13T20:00:11Z")

</div>

Salve a tutti! Ho un piccolo problema a gestire i link interni…come  
faccio ad aggiungere l’ancora all’url (il #nomeAncora)?  
Il mio home\_controller Ã¨ il seguente:

class HomeController \< ApplicationController

```
def index
  @posts = Post.find(:all)
end

def show_comment
  @posts = Post.find(:all)
  @comments = Comment.find(:all, :conditions => ['post_id= ?',

```

params[:id] ])  
end

```
def add_comment
  @posts = Post.find(:all)
  @comments = Comment.find(:all, :conditions => ['post_id= ?',

```

params[:id] ])  
if flash[:comment]  
@comment = flash[:comment]  
else  
@comment = Comment.new  
end  
end

end

add\_comment e show\_comment hanno le rispettive views, perÃ² quando  
seleziono un link dall’index a, ad esempio, show\_comment non so come  
aggiungere all’url [http://mioSito/home/show\_comment/1](http://mioSito/home/show_comment/1) la stringa  
contenente l’ancora #nomeAncora. Qualcuno puÃ² darmi una mano?

---

<div class="post-metadata">

**Author:** ![mckracken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@mckracken](https://www.ruby-forum.com/u/mckracken)\
**Post date:** [April 16, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/problema-link-interni/134670/2 "2008-04-16T23:23:45Z")

</div>

Emanuele B. wrote:

> add\_comment e show\_comment hanno le rispettive views, perÃ² quando  
> seleziono un link dall’index a, ad esempio, show\_comment non so come  
> aggiungere all’url [http://mioSito/home/show\_comment/1](http://mioSito/home/show_comment/1) la stringa  
> contenente l’ancora #nomeAncora. Qualcuno puÃ² darmi una mano?

link\_to ‘ciao’, :action =\> ‘show\_comment’, :anchor =\> ‘nomeAncora’
