mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
We are using railtie, not engine
This commit is contained in:
parent
40cc72548f
commit
346a7528ef
3 changed files with 2 additions and 37 deletions
|
@ -1,36 +0,0 @@
|
|||
require "rails"
|
||||
require "action_cable"
|
||||
require "action_cable/helpers/action_cable_helper"
|
||||
require "active_support/core_ext/hash/indifferent_access"
|
||||
|
||||
module ActionCable
|
||||
class Railtie < Rails::Engine # :nodoc:
|
||||
config.action_cable = ActiveSupport::OrderedOptions.new
|
||||
config.eager_load_namespaces << ActionCable
|
||||
|
||||
initializer "action_cable.helpers" do
|
||||
ActiveSupport.on_load(:action_view) do
|
||||
include ActionCable::Helpers::ActionCableHelper
|
||||
end
|
||||
end
|
||||
|
||||
initializer "action_cable.logger" do
|
||||
ActiveSupport.on_load(:action_cable) { self.logger ||= ::Rails.logger }
|
||||
end
|
||||
|
||||
initializer "action_cable.set_configs" do |app|
|
||||
app.paths.add "config/redis/cable", with: "config/redis/cable.yml"
|
||||
|
||||
options = app.config.action_cable
|
||||
|
||||
options.allowed_request_origins ||= "http://localhost:3000" if ::Rails.env.development?
|
||||
|
||||
ActiveSupport.on_load(:action_cable) do
|
||||
path = Pathname.new(paths["config/redis/cable"].existent.first)
|
||||
self.redis = Rails.application.config_for(redis_path).with_indifferent_access
|
||||
|
||||
options.each { |k,v| send("#{k}=", v) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
require "rails"
|
||||
require "action_cable"
|
||||
require "action_cable/helpers/action_cable_helper"
|
||||
require "active_support/core_ext/hash/indifferent_access"
|
||||
|
||||
module ActionCable
|
||||
class Railtie < Rails::Railtie # :nodoc:
|
||||
|
|
|
@ -11,7 +11,7 @@ require "active_job/railtie"
|
|||
require "action_controller/railtie"
|
||||
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
|
||||
require "action_view/railtie"
|
||||
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
||||
<%= comment_if :skip_action_cable %>require "action_cable/railtie"
|
||||
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
||||
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue