diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-07-12 10:06:56 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-07-12 11:44:56 -0500 |
commit | 53c82f6dc036fab537b67b011ae604af646a58a3 (patch) | |
tree | 8594efedad8391f1e23bb1f8e4edd3ba5d68c325 /lib/action_cable | |
parent | 8fde483eb02f6d89eaab8590a4ddcd406d74900f (diff) | |
download | rails-53c82f6dc036fab537b67b011ae604af646a58a3.tar.gz rails-53c82f6dc036fab537b67b011ae604af646a58a3.tar.bz2 rails-53c82f6dc036fab537b67b011ae604af646a58a3.zip |
Add actionpack as a dependency
Diffstat (limited to 'lib/action_cable')
-rw-r--r-- | lib/action_cable/connection/base.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb index ff7a98f777..5671dc1f88 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -1,3 +1,5 @@ +require 'action_dispatch/http/request' + module ActionCable module Connection # For every websocket the cable server is accepting, a Connection object will be instantiated. This instance becomes the parent @@ -117,7 +119,10 @@ module ActionCable protected # The request that initiated the websocket connection is available here. This gives access to the environment, cookies, etc. def request - @request ||= ActionDispatch::Request.new(Rails.application.env_config.merge(env)) + @request ||= begin + environment = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application + ActionDispatch::Request.new(environment || env) + end end # The cookies of the request that initiated the websocket connection. Useful for performing authorization checks. |