Forum: Ruby on Rails Adding Query String to Link

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jeremy L. (Guest)
on 2007-07-28 06:48
I am using ThickBox/jQuery for an app. With it I need to be able to add
a query string to the end of a dynamically generated URL. For example

This is how my links are generated

<%= link_to @testimonial.customer, testimonial_url(:id =>, :class => 'thickbox' %>

How do I add the query string to the end of that URL?

I found a semi working solution in :anchor like

<%= link_to @testimonial.customer, testimonial_url(:id =>, :anchor => '?height=300&width=300'), :class =>
'thickbox' %>

But I would like to do it right so I know there are no bugs.
ryanbriones (Guest)
on 2007-07-28 08:28
(Received via mailing list)
Jeremy L. wrote:
I ran into the same issue last week and your code led me to the
Looks like unreserved keys that are passed to the options hash url_for,
which is what testimonial_url calls down the line, get turned into query
string params. So:

<%= link_to @testimonial.customer, testimonial_url(:id =>, :height => 300, :width => 300), :class =>
'thickbox' %>

Thanks for helping me! Hope this helps you.

Ryan Carmelo Briones
View this message in context:
Sent from the RubyOnRails Users mailing list archive at
This topic is locked and can not be replied to.