I am trying to figure out the new link_to
in Rails 3
but i still don't get it
In Rails 2 I do:
<%= link_to_remote "My Link",:url=>{:action=>:myaction},:with=>"'data='+$('#someField').attr('value')" %>
but with the new syntax in Rails 3 how should it be?
I'm trying something like
<%=link_to "My Link",{:action=>"myaction"},:with=>"'data='+$('#someField').attr('value');",:remote=>true%>
but I'm not getting the quantity params in the controller's action
Something like this will send a "data" parameter with the value = 10.
link_to "My Link", { :controller => 'myctrler', :action=>"myact", :data=> 10 }, :remote=>true
I've never seen/used the :with option before. I'm sorry I can't help on that one.
They say its no longer supported in this answer on How to send Javascript Variable to a controller's action with the link_to helper?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With