gpt4 book ai didi

ruby-on-rails - 即使 ActionCable 已从应用程序和系统中完全删除,Rails 应用程序仍会发出 GET 请求/电缆路由

转载 作者:行者123 更新时间:2023-12-05 05:03:48 25 4
gpt4 key购买 nike

我想从我的 Rails 应用程序中删除 ActionCable,我找到了 this它表示用所有 rails 组件 gems minus gem 'action_cable' 替换 Gemfile 中的 gem rails。我这样做了,然后从 gemfile.lock 中手动删除了操作电缆

# gem 'rails', '5.2.0'
gem 'activerecord', '5.2.0'
gem 'activemodel', '5.2.0'
gem 'actionpack', '5.2.0'
gem 'actionview', '5.2.0'
gem 'actionmailer', '5.2.0'
gem 'activejob', '5.2.0'
gem 'activesupport', '5.2.0'
gem 'railties', '5.2.0'
gem 'sprockets-rails'

Gemfile.lock:

rails (5.2.0)
#bye bye action cable
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)

为了安全起见,我使用了现在非常情绪化 rake assets:clobber 命令。但是当我启动服务器时,日志表明与 actioncable 相关的内容仍然存在:

Started GET "/cable" for ::1 at 2020-04-26 17:25:08 -0700      
ActionController::RoutingError (No route matches [GET] "/cable"):
actionpack (5.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
rack-timeout (0.6.0) lib/rack/timeout/core.rb:151:in `block in call'
rack-timeout (0.6.0) lib/rack/timeout/support/timeout.rb:19:in `timeout'
rack-timeout (0.6.0) lib/rack/timeout/core.rb:150:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.2) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.0) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
railties (5.2.0) lib/rails/engine.rb:524:in `call'
puma (4.3.3) lib/puma/configuration.rb:228:in `call'
puma (4.3.3) lib/puma/server.rb:682:in `handle_request'
puma (4.3.3) lib/puma/server.rb:472:in `process_client'
puma (4.3.3) lib/puma/server.rb:328:in `block in run'
puma (4.3.3) lib/puma/thread_pool.rb:134:in `block in spawn_thread'

我什至运行了 gem uninstall action_cable 并从我的系统中删除了所有版本。为什么它困扰着我? ActionCable 变成了一个无解的麻烦。

最佳答案

首先,如果您从 gemfile 中删除 gem,然后运行 ​​bundle install , 它只会安装你的 gemfile 中的 gem 并且应该已经更新了 gemfile.lock ,但它不会从您的系统中卸载 gem。

但是您必须通过调用 gem install <gemname> 从系统中删除 gem .

See this post

关于ruby-on-rails - 即使 ActionCable 已从应用程序和系统中完全删除,Rails 应用程序仍会发出 GET 请求/电缆路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61449897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com