diff options
author | Eileen M. Uchitelle <eileencodes@gmail.com> | 2016-06-30 13:44:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-30 13:44:21 -0400 |
commit | b96bd9c4cbdeec0f8076344a5a946ef3ee828f76 (patch) | |
tree | 3c7468419254c3dfbfb862926aa6b142129a3a70 | |
parent | 19ba6b8d4e06cc8c2e596d576fcfbfce22fa5137 (diff) | |
parent | 39b576a31a7e973192f8b15a4fe067b5f1053cad (diff) | |
download | rails-b96bd9c4cbdeec0f8076344a5a946ef3ee828f76.tar.gz rails-b96bd9c4cbdeec0f8076344a5a946ef3ee828f76.tar.bz2 rails-b96bd9c4cbdeec0f8076344a5a946ef3ee828f76.zip |
Merge pull request #25608 from rosenfeld/patch-7
Add an upgrade note related to ActionController::Live becoming a Concern
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 97d8cd392a..f276f64807 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -249,6 +249,35 @@ Rails.application.configure do end ``` +### `ActionController::Live` became a `Concern` + +That means that if your application used to have its own streaming module, the following code +would break in production mode: + +```ruby +# This is a work-around for streamed controllers performing authentication with Warden/Devise. +# See https://github.com/plataformatec/devise/issues/2332 +# Authenticating in the router is another solution as suggested in that issue +class StreamingSupport + include ActionController::Live # this won't work in production for Rails 5 + # extend ActiveSupport::Concern # unless you uncomment this line. + + def process(name) + super(name) + rescue ArgumentError => e + if e.message == 'uncaught throw :warden' + throw :warden + else + raise e + end + end +end +``` + +If you include `ActionController::Live` in another module that is included in your controller you +should also extend the module with `ActiveSupport::Concern`. Or you could use the `self.included` hook +to include `ActionController::Live` directly to the controller once the `StreamingSupport` is included. + ### New Framework Defaults #### Active Record `belongs_to` Required by Default Option |