Forum: Ruby on Rails What's the correct way to use ":with" with link_to_remote?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cameron Price (Guest)
on 2006-03-12 19:26
(Received via mailing list)
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
Cameron Price (Guest)
on 2006-03-12 20:00
(Received via mailing list)
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
This topic is locked and can not be replied to.