Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ Copy rails.js from http://github.com/rails/jquery-ujs/raw/master/src/rails.js in

=== Step 3 (optional)

Switch the <tt>javascript_include_tag :defaults</tt> to use jquery instead of the default prototype helpers. Uncomment following line from file <tt>config/application.rb</tt>
Uncomment following line from file <tt>config/application.rb</tt>

config.action_view.javascript_expansions[:defaults] = %w(jquery rails application)

To load jQuery from a CDN such as Google, just specify the full path. Change the above to

config.action_view.javascript_expansions[:defaults] = %w(https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js rails application)

Alternatively, you can specify the exact files to load in <tt>app/views/layouts/application.html.erb</tt>. Change <tt>javascript_include_tag :defaults</tt> to use jQuery
<%= javascript_include_tag 'jquery' %>
or
<%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' %>
instead of the default prototype helpers.

= Testing

== Installation
Expand Down
4 changes: 2 additions & 2 deletions src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jQuery(function ($) {
type: method.toUpperCase(),
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "text/javascript");
if ($this.triggerHandler('ajax:beforeSend') === false) {
if (el.triggerAndReturn('ajax:beforeSend') === false) {
return false;
}
},
Expand Down Expand Up @@ -139,7 +139,7 @@ jQuery(function ($) {
});
};

$(disable_with_form_remote_selector).live('ajax:before.rails', disable_with_input_function);
$(disable_with_form_remote_selector).live('ajax:beforeSend.rails', disable_with_input_function);
$(disable_with_form_not_remote_selector).live('submit.rails', disable_with_input_function);

$(disable_with_form_remote_selector).live('ajax:complete.rails', function () {
Expand Down