From 3a6e8e464c0d8b77d11fbfcf3d650423b060394c Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Sat, 1 Sep 2012 15:58:24 +0400 Subject: Sprockets-rails tests fail Method invalid_asset_host! was delegated to controller but sprockets compile assets in their own scope without controller. And if we set asset_host with second parameter it should raise error through invalid_asset_host!. But since controller is nil it cannot be reached. --- actionpack/lib/action_view/asset_paths.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_view/asset_paths.rb') diff --git a/actionpack/lib/action_view/asset_paths.rb b/actionpack/lib/action_view/asset_paths.rb index 3ddd8bd552..a9216c4333 100644 --- a/actionpack/lib/action_view/asset_paths.rb +++ b/actionpack/lib/action_view/asset_paths.rb @@ -1,6 +1,6 @@ require 'zlib' require 'active_support/core_ext/file' -require 'active_support/core_ext/module/delegation' +require 'action_controller/metal/exceptions' module ActionView class AssetPaths #:nodoc: @@ -8,8 +8,6 @@ module ActionView attr_reader :config, :controller - delegate :invalid_asset_host!, :to => :controller, :prefix => false - def initialize(config, controller = nil) @config = config @controller = controller @@ -99,6 +97,10 @@ module ActionView @config.default_asset_host_protocol || (has_request? ? :request : :relative) end + def invalid_asset_host!(help_message) + raise ActionView::MissingRequestError, "This asset host cannot be computed without a request in scope. #{help_message}" + end + # Pick an asset host for this source. Returns +nil+ if no host is set, # the host if no wildcard is set, the host interpolated with the # numbers 0-3 if it contains %d (the number is the source hash mod 4), -- cgit v1.2.3