Link_to within an HTML table


#1

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


#2

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


#3

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?


#4

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