If the project is generated with --minimal option on Rails 6 (and you don’t want to use webpacker), you may need to add JavaScript like the below.

config/initializers/assets.rb

Rails.application.config.assets.paths << "#{Rails.root}/app/javascript"
Rails.application.config.assets.precompile += %w( application.js )

app/javascript/application.js

//= require rails-ujs
//= require_tree .

app/views/layonts/application.html.erb

<%= javascript_include_tag 'application' %>