views:

22

answers:

1

What's the preferred UJS replacement for the Rails RJS helper ':with' parameter on a link_to_remote when upgrading to Rails 3 (using the new unobtrusive link_to... :remote => true syntax).

eg. Replacement for:

link_to_remote "Ajax Call", example_path(@thing), :with => "'foo=' + $('field').val()"

Specifically, I'm looking into a link that sends a put request using ajax with the value of a select option to update some other field in a form.

What's the nicest unobtrusive way to do this?

A: 

As a temporary measure I've added a small hack to the jquery.rails.js file:

line 34 changed from:

var data = el.is('form') ? el.serializeArray() : [];

to

var data = el.is('form') ? el.serializeArray() : eval(el.attr('with'));

However the obtrusive js remains...

Jo