diff --git a/actionpack/lib/action_view/helpers/ajax_helper.rb b/actionpack/lib/action_view/helpers/ajax_helper.rb
index 5a9c4e7386..f6c9952031 100644
--- a/actionpack/lib/action_view/helpers/ajax_helper.rb
+++ b/actionpack/lib/action_view/helpers/ajax_helper.rb
@@ -600,7 +600,7 @@ module ActionView
private
def set_callbacks(options, html)
- [:uninitialized, :complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
+ [:before, :after, :uninitialized, :complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
html["data-on#{type}"] = options.delete(type.to_sym)
end
diff --git a/actionpack/test/template/ajax_helper_test.rb b/actionpack/test/template/ajax_helper_test.rb
index 095454977e..4d76007d52 100644
--- a/actionpack/test/template/ajax_helper_test.rb
+++ b/actionpack/test/template/ajax_helper_test.rb
@@ -86,6 +86,11 @@ class AjaxHelperTest < AjaxHelperBaseTest
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
end
+ test "link_to_remote with before/after callbacks" do
+ assert_dom_equal %(Remote outauthor),
+ link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :before => "before();", :after => "after();")
+ end
+
test "link_to_remote with method delete" do
assert_dom_equal %(Remote outauthor),
link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }, :method => "delete"}, { :class => "fine" })