aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/controllers/active_storage/base_controller.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-08-16 01:41:15 -0400
committerGeorge Claghorn <george.claghorn@gmail.com>2018-08-16 01:41:15 -0400
commite33c3cd8ccbecaca6c6af0438956431b02cb3fb2 (patch)
tree3c4285fda6f56507976227abd339395ab1e616ea /activestorage/app/controllers/active_storage/base_controller.rb
parent51bdbc2d0198c666cd62d1404c18da477e5cbfbc (diff)
downloadrails-e33c3cd8ccbecaca6c6af0438956431b02cb3fb2.tar.gz
rails-e33c3cd8ccbecaca6c6af0438956431b02cb3fb2.tar.bz2
rails-e33c3cd8ccbecaca6c6af0438956431b02cb3fb2.zip
Extract ActiveStorage::SetCurrent
Provide a handy concern for custom Active Storage controllers that can't inherit from ActiveStorage::BaseController.
Diffstat (limited to 'activestorage/app/controllers/active_storage/base_controller.rb')
-rw-r--r--activestorage/app/controllers/active_storage/base_controller.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/activestorage/app/controllers/active_storage/base_controller.rb b/activestorage/app/controllers/active_storage/base_controller.rb
index 59312ac8df..b27d2bd8aa 100644
--- a/activestorage/app/controllers/active_storage/base_controller.rb
+++ b/activestorage/app/controllers/active_storage/base_controller.rb
@@ -1,10 +1,8 @@
# frozen_string_literal: true
-# The base controller for all ActiveStorage controllers.
+# The base class for all Active Storage controllers.
class ActiveStorage::BaseController < ActionController::Base
- protect_from_forgery with: :exception
+ include ActiveStorage::SetCurrent
- before_action do
- ActiveStorage::Current.host = request.base_url
- end
+ protect_from_forgery with: :exception
end