# Link\_to within an HTML table

**URL:** <https://www.ruby-forum.com/t/link-to-within-an-html-table/157127>\
**Category:** Rails\
**Created:** [January 7, 2009, 5:11pm UTC](https://www.ruby-forum.com/t/link-to-within-an-html-table/157127 "2009-01-07T17:11:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![srj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@srj](https://www.ruby-forum.com/u/srj)\
**Post date:** [January 7, 2009, 5:11pm UTC](https://www.ruby-forum.com/t/link-to-within-an-html-table/157127/1 "2009-01-07T17:11:16Z")

</div>

I am using Rails 2.2.2 and put together a show.html.erb template to  
display relevant details of my model (model A). Model A has a one-to-  
many relationship to another model model B, and those details are  
displayed as individual rows in a table. One of those columns is a  
link to another show page on model B’s controller to display model B’s  
details. I use:

```
       <% for b_model in a_model.get_all_b_children %>

```

to loop through all the children (B’s)

This all works and looks just as I expected, with one exception - the  
link displayed in the table shows up as a link, but it is not  
clickable - my pointer does not change and if I click it, nothing  
happens. It looks like it is nothing more than underlined text.

If I pull the link\_to call out of my table (out of the for-loop) and  
place it elsewhere on the page, it works perfectly (of course, I need  
to manually dig model B out of model A, but I believe that is  
immaterial).

Any thoughts as to why link\_to does not work from within a table?

Thank you for any help,

Steve

---

<div class="post-metadata">

**Author:** ![srj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@srj](https://www.ruby-forum.com/u/srj)\
**Post date:** [January 7, 2009, 5:13pm UTC](https://www.ruby-forum.com/t/link-to-within-an-html-table/157127/2 "2009-01-07T17:13:37Z")

</div>

On 7 Jan 2009, at 16:10, srj wrote:

> to loop through all the children (B’s)
> 
> This all works and looks just as I expected, with one exception - the  
> link displayed in the table shows up as a link, but it is not  
> clickable - my pointer does not change and if I click it, nothing  
> happens. It looks like it is nothing more than underlined text.

I’d guess you’ve generated invalid html. Have your tried pasting the  
html into the w3c validator ?

Fred

---

<div class="post-metadata">

**Author:** ![srj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@srj](https://www.ruby-forum.com/u/srj)\
**Post date:** [January 7, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/link-to-within-an-html-table/157127/3 "2009-01-07T17:39:52Z")

</div>

> Any thoughts as to why link\_to does not work from within a table?

Have you checked your logs to see if there is any errors being thrown?

---

<div class="post-metadata">

**Author:** ![srj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@srj](https://www.ruby-forum.com/u/srj)\
**Post date:** [January 9, 2009, 1:03am UTC](https://www.ruby-forum.com/t/link-to-within-an-html-table/157127/4 "2009-01-09T01:03:31Z")

</div>

I’ve had the same problem…  
Just the other day my webhosting company decided to suddenly upgrade  
Rails to 2.2.2…

It breaks my old “for” loops like what srj mentioned, in my views for  
some reason.  
It also breaks my link\_to(s)…

Does anyone know a solution for changing the old link\_to(s) to  
something that works with 2.2.2?

Thanks

andy

On Jan 7, 8:39 am, Shandy N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
