All threads / Bulk Operations in Rails Discussion

Ask A Question


You’re not receiving notifications from this thread.

Bulk Operations in Rails Discussion

Dicussion for Bulk Operations in Rails

Super usefull episode! Thank you!


For those of you who want to use fetch instead of Rails.ajax:

let token = document.querySelector('meta[name="csrf-token"]').content;
fetch(/your/path, {
method: "DELETE",
headers: {
"X-CSRF-Token": token,
body: data,
}).then((response) => {
if (response.redirected) {
window.location.href = response.url;


I'm just wondering if strong parameters are still necessary in this scenario?


For anyone in the future who wants to get this to work with turbo, you will have to convert the FormData into a query string, and append that string to a form action (In my case I used the button_to tag). This way the fetch remains within turbo.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,406+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.