From 7185e35971f4a18f48a7d67e5c86c2fcf87bdb66 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 11 Aug 2012 15:14:42 +0200 Subject: Remove dependency on actionpack in ActionView::AssetPaths Since Action View should not depend on actionpack, it's best to delegate invalid_asset_host! to controller and just rely on such simple contract instead of raising ActionController::RoutingError directly. --- actionpack/lib/action_controller/base.rb | 2 +- actionpack/lib/action_controller/metal/asset_paths.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 actionpack/lib/action_controller/metal/asset_paths.rb (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f829f5e8a2..0d79e046a1 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -183,8 +183,8 @@ module ActionController MODULES = [ AbstractController::Layouts, AbstractController::Translation, - AbstractController::AssetPaths, + AssetPaths, Helpers, HideActions, UrlFor, diff --git a/actionpack/lib/action_controller/metal/asset_paths.rb b/actionpack/lib/action_controller/metal/asset_paths.rb new file mode 100644 index 0000000000..5165814dfe --- /dev/null +++ b/actionpack/lib/action_controller/metal/asset_paths.rb @@ -0,0 +1,15 @@ +require 'action_controller/metal/exceptions' + +module ActionController + module AssetPaths + extend ActiveSupport::Concern + + included do + include AbstractController::AssetPaths + end + + def invalid_asset_host!(help_message) + raise ActionController::RoutingError, "This asset host cannot be computed without a request in scope. #{help_message}" + end + end +end -- cgit v1.2.3