Url_for or resource_url additional params?


#1

if i want a link to book_url(@book), but i want to pass an additional
param, how to i do that?

i want it to result in something like http://localhost/books/1?foo=bar

this works, but seems hackish:

url_for(:controller => book_path(@book), :foo => “bar”, :only_path =>
false)


#2

On Aug 1, 2007, at 3:38 PM, Joe N. wrote:

if i want a link to book_url(@book), but i want to pass an additional
param, how to i do that?

i want it to result in something like http://localhost/books/1?foo=bar

this works, but seems hackish:

url_for(:controller => book_path(@book), :foo => “bar”, :only_path =>
false)

book_url(:id => @book, :foo => ‘bar’)

You have to use the hash format even for the :id when you want to add
other parameters.

-Rob

Rob B. http://agileconsultingllc.com
removed_email_address@domain.invalid