From 0f78dbcf07e7ea33e7662175866999bae6e51e7a Mon Sep 17 00:00:00 2001 From: Kristupas Stumbrys Date: Wed, 6 Mar 2019 14:35:48 +0100 Subject: [PATCH] Adding authenticity_token to sort POST request --- app/assets/javascripts/activeadmin_sortable_table.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/activeadmin_sortable_table.js b/app/assets/javascripts/activeadmin_sortable_table.js index 3afa76db..552e5606 100644 --- a/app/assets/javascripts/activeadmin_sortable_table.js +++ b/app/assets/javascripts/activeadmin_sortable_table.js @@ -29,10 +29,11 @@ var newPosition = nextPosition; } + var AUTH_TOKEN = $('meta[name=csrf-token]').attr('content'); $.ajax({ url: url, type: 'post', - data: $.extend(customParams, { position: newPosition }), + data: $.extend(customParams, { position: newPosition, authenticity_token: AUTH_TOKEN }), error: function () { console.error('Saving sortable error'); }, success: function () { location.href = location.href;