3

我已经修补了 websocket-rails gem 以在我的开发设置中工作。

我在 config/initializers 下创建了一个文件 websocket_patch.rb 并从websocket-rails-0.7.0\lib\rails\app\controllers\websocket_rails\delegation_controller.rb复制了代码

module WebsocketRails
  class DelegationController < ApplicationController
  end
end

已添加命名空间Namespace1以引用该文件并与我的项目结构相匹配。

Current project structure is like 

Project folder
      |_namespace1-/app/../application_controller.rb
      |_namespace2-/app/../application_controller.rb

所以我必须覆盖delegation_controller.rb 中的默认访问。

  Project folder
     |_config/initializers/websocket_patch.rb

  module WebsocketRails
    class DelegationController < Namespace1::ApplicationController
    end
  end

它在开发环境中正常工作,但在生产中中断。它返回 gem 文件以供参考,而不是在 config/initializers 下加载文件

websocket-rails-0.7.0/lib/rails/app/controllers/websocket_rails/delegation_controller.rb:11:in `<module:WebsocketRails>': uninitialized constant WebsocketRails::ApplicationController (NameError)   

Rails 版本:3.2.22.4,Ruby 版本:2.2,生产中没有用于加载初始化程序的特定配置。如果您需要有关此的更多信息,请告诉我

4

0 回答 0