I have a Ruby on Rails single page application using React as the front-end, and since we upgraded from Rails 6.1 to Rails 7.0, the warning "DEPRECATION: action_cable.js has been renamed to actioncable.js – please update your reference before Rails 8" appears on the browser console in almost every page of the application, except for static views (without forms or such) such as e-mails and the home page.Warning on the browser console
I've tried reviewing my Gemfile to make sure they are up-to-date, ran bundle update
hoping that the problem was caused by an outdated gem, but the warning is still there. I've checked the project folder, and there is no "action_cable.js" or "actioncable.js" file, nor are there any references to those files/paths in any part of the code.
Does anybody have an idea on how to fix this warning? I couldn't find any information on how to do it, or other people that are having the same issue.
This is my first time posting here, so if there's any information missing, I'll be more than happy to share it!
In my app/assets/javascripts/cable.js
file there is a reference to require action_cable
(which makes the assumption that you're looking for action_cable.js
. I believe this file lives in the actioncable
gem and that's why you couldn't find it.
Making the following change in the require comment like so should fix it:
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the rails generate channel command.
//
// CHANGE THIS this require from action_cable to actioncable
//= require actioncable
//= require_self
//= require_tree ./channels
You will probably need to rebuild your javascript assets like so:
rake assets:clean && rake assets:precompile
And even a server reboot might be needed as well.