diff --git a/src/rails.js b/src/rails.js
index 93620134..ba5fc933 100644
--- a/src/rails.js
+++ b/src/rails.js
@@ -131,6 +131,9 @@
method = element.data('method');
url = element.data('url');
data = element.serialize();
+ if (element.is('input[type=checkbox],input[type=radio]')) {
+ data = element.attr('name') + '=0&' + data;
+ }
if (element.data('params')) data = data + '&' + element.data('params');
} else if (element.is(rails.buttonClickSelector)) {
method = element.data('method') || 'get';
diff --git a/test/public/test/data-remote.js b/test/public/test/data-remote.js
index 215d8217..24501120 100644
--- a/test/public/test/data-remote.js
+++ b/test/public/test/data-remote.js
@@ -143,6 +143,34 @@ asyncTest('changing a select option with data-remote attribute', 5, function() {
.trigger('change');
});
+asyncTest('submitting an unchecked checkbox with data-remote attribute submits input with value 0', 3, function () {
+ $('#qunit-fixture')
+ .append($(''));
+
+ $('input[type="checkbox"][data-remote]')
+ .on('ajax:success', function (e, data, status, xhr) {
+ App.assertCallbackInvoked('ajax:success');
+ App.assertRequestPath(data, '/echo');
+ equal(data.params.user.active, '0', 'ajax arguments should have key active with value 0');
+ })
+ .on('ajax:complete', function () { start() })
+ .trigger('change');
+})
+
+asyncTest('submitting an unchecked radio button with data-remote attribute submits input with value 0', 3, function () {
+ $('#qunit-fixture')
+ .append($(''));
+
+ $('input[type="radio"][data-remote]')
+ .on('ajax:success', function (e, data, status, xhr) {
+ App.assertCallbackInvoked('ajax:success');
+ App.assertRequestPath(data, '/echo');
+ equal(data.params.user.active, '0', 'ajax arguments should have key active with value 0');
+ })
+ .on('ajax:complete', function () { start() })
+ .trigger('change');
+})
+
asyncTest('submitting form with data-remote attribute', 4, function() {
$('form[data-remote]')
.on('ajax:success', function(e, data, status, xhr) {