I agree. I think that we have to use some sense where applicable. However, the overall concept, I feel, is in the right direction for maintainable code. I would much prefer this over the other extreme where classes and methods are huge. I've seen some classes with over 1000 lines of code and also some methods with 600 lines of code. They're completely unmaintainable and writing tests for huge methods is near impossible.
Yea, it's really strange. On Rails 6, changing it remove the jQuery dependency, it doesn't work.
I updated your code to
```
Rails.showConfirmationDialog = function (link) {
const message = link.data('confirm')
return swal.fire(
{
title: message,
type: 'warning',
showCancelButton: true,
reverseButtons: true
}
).then(function (result) {
if (result.value) { return Rails.confirmed(link) }
})
}
```
and the javascript alert fires, but the SweetAlert doesn't. It has to be something with the `showConfirmationDialog` not getting set or fired properly.
And, changing the original code with your confirmed element instead of removing the data attribute doesn't work either. It's really strange.
`Rails.confirmed(element)`
My guess is that there will be a lot of fine tuning done so it better fits into the Rails-way/style of things. I think that it has made some good improvements since its original design. I haven't given complete buy in to it yet, but will definitely be keeping a close eye on it over the next many months. Though, having a lot of my view being tested in the same fashion of the rest of my code does seem very appealing.