Skip to content

Commit 5d06d6b

Browse files
committed
Fix @rails/ujs init / use ES6 module syntax
Prior to this code change, any value assigned to the `'data-method':` attribute of the `link_to` method was not being read (and instead defaulting to `GET`). This was resulting in the breaking of several `spec/features/` tests (https://github.com/DMPRoadmap/roadmap/actions/runs/9946998559/job/27478725801). The `@rails/ujs` library is meant to handle this `'data-method':` attribute.
1 parent d06f436 commit 5d06d6b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

app/javascript/application.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ import './src/superAdmin/notifications/edit';
8181
import './src/superAdmin/themes/newEdit';
8282
import './src/superAdmin/users/edit';
8383

84-
// Since we're using Webpacker to manage JS we need to startup Rails' Unobtrusive JS
85-
// and Turbo. ActiveStorage and ActionCable would also need to be in here
86-
// if we decide to implement either before Rails 6
87-
require('@rails/ujs').start();
84+
// We need to startup Rails' Unobtrusive JS and Turbo.
85+
// ActiveStorage and ActionCable would also need
86+
// to be in here if we decide to implement either.
87+
import Rails from "@rails/ujs";
88+
Rails.start();
8889

8990
// TODO: Disabled turbo for the time being because our custom JS is not
9091
// properly setup to work with it. We should review the docs:

0 commit comments

Comments
 (0)