Closed christianmeichtry closed 2 years ago
@christianmeichtry in order for this to work both jquery and rails_ujs needs to be installed and initialized. Everything works fine in sample app (Rails 6.1) with following content of app/javascript/packs/application.js
:
import Rails from "@rails/ujs"
import Turbolinks from "turbolinks"
import * as ActiveStorage from "@rails/activestorage"
import "channels"
Rails.start()
Turbolinks.start()
ActiveStorage.start()
and webpack configuration (in config/webpack/environment.js
)
const { environment } = require('@rails/webpacker')
const webpack = require('webpack')
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
$: 'jquery/src/jquery',
jQuery: 'jquery/src/jquery'
})
)
module.exports = environment
Most likely at least jquery dependency should be removed, but that's out of current scope.
When the frontend value gets send, the CSRF token is not valid