Cameron Price
2006-Mar-12 17:25 UTC
[Rails] What''s the correct way to use ":with" with link_to_remote?
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
2006-Mar-12 17:58 UTC
[Rails] Re: What''s the correct way to use ":with" with link_to_remote?
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 On 3/12/06, Cameron Price <cameronp@gmail.com> wrote:> 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 >