Skip to content
Advertisement

Tag: ruby-on-rails

Bootstrap JS not working with Rails Importmap

I have a Rails 7 App that I’m using Importmap with. I’m loading the Bootstrap JS via the gem and docs so my config/importmap.rb has: config/initializers/assets.rb application.js Stuff like dropdowns activated via data attributes work well but my custom JS gives the error: Uncaught TypeError: bootstrap.Popover is not a constructor Answer How to initialize Popper (tooltips) with importmaps You’re very

Updating a rails record with vanilla javascript

Is it possible to update a rails record with vanilla javascript without intercepting the data and converting it to a hash in the controller? Here is my code: If I just send the data without stringifying it, it shows up in the rails controller at user: [object, object]. In the update action I update the params like this: params[“user”] =

Rails 7 JavaScript event listeners stop working after browser back?

I have rails 7 app where I’m trying to build a search bar using either tom-select or slim-select. My issue reproduces no matter which library I’m using therefore it must be the issue on my rails side. app/views/cities/index.html.erb and this is my js controller (in this case I’m using tom-select) app/javascript/controllers/ts/search_controller.js app/controllers/cities_controller.rb Problem Repro: Open cities index and click on

Advertisement