What's the correct way to use ":with" with link_to_remote?


#1

I’m using Rails 1.0, and I’m trying to setup a link_to_remote which
takes as a parameter a value computed in javascript. In order to
accomplish this I’m using this command:

<%= link_to_remote(‘TouchUp’, :update => ‘touchup_section’, :url =>
{:action => ‘touchup’, :id => @article}, :with => “get_selection()” )
%>

This works, but the name of the parameter is whatever is returned by
get_selection (a string). I can’t see how to name the parameter so
that I might access it in my controller.

Thanks in advance.

-cameron


#2

Just figured it out. this works:
<%= link_to_remote(‘TouchUp’, :update => ‘touchup_section’, :url =>
{:action => ‘touchup’, :id => @article}, :with => “‘selection=’ +
get_selection()” )
%>

(added ‘selection=’ before the value).

-c