in my app/javascript/packs/application.js
:
import Rails from '@rails/ujs';
Rails.start();
and then in whatever module, controller, component I’m writing:
import Rails from '@rails/ujs';
More Related Contents:
- Rails: Webpacker 4.2 can’t find application in /app/public/packs/manifest.json heroku
- Rails 5/6: How to include JS functions with webpacker?
- How to avoid NoMethodError for missing elements in nested hashes, without repeated nil checks?
- Why can you not have a foreign key in a polymorphic association?
- Rails: confused about syntax for passing locals to partials
- TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
- Add Custom Field/Column to Devise with Rails 4
- Ruby on Rails: Submitting an array in a form
- How can I test the page title with Capybara 2.0?
- What does “WARN Could not determine content-length of response body.” mean and how to I get rid of it?
- Difference between string and text in rails?
- What is the replacement for ActionController::Base.relative_url_root?
- Rails new vs create
- Parse a string as if it were a querystring in Ruby on Rails
- POST json to rails server
- Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets
- Rails 3 UTF-8 query string showing up in URL?
- how to read a User uploaded file, without saving it to the database
- How to display the time in user’s timezone
- form_for but to post to a different action
- how to add records to has_many :through association in rails
- Convert UTC to local time in Rails 3
- Rails form_for :remote=>true is not calling js method
- Remote mysql database on Heroku app
- Ruby on Rails 3 howto make ‘OR’ condition
- How to solve ‘libcurl’ not found with Rails on Windows
- Rails catch-all/globbing routes
- Always getting 401 Unauthorized with new install of Rails + Devise
- using has_many :through and build
- Where to store sensitive data in public rails app?