diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-09-01 05:33:31 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-09-01 05:33:31 -0700 |
commit | 2a95a661cfa5f17f9e2176fd80e8c7389b33fbb0 (patch) | |
tree | d255d82fa056cb77168b771641383655f0b086b8 | |
parent | 5f99bdbec2d3ffab416795ac48e350863e0e17d7 (diff) | |
parent | 3a6e8e464c0d8b77d11fbfcf3d650423b060394c (diff) | |
download | rails-2a95a661cfa5f17f9e2176fd80e8c7389b33fbb0.tar.gz rails-2a95a661cfa5f17f9e2176fd80e8c7389b33fbb0.tar.bz2 rails-2a95a661cfa5f17f9e2176fd80e8c7389b33fbb0.zip |
Merge pull request #7494 from route/actionview_decoupling_issue
ActionView decoupling and sprockets-rails tests fail
-rw-r--r-- | actionpack/lib/action_controller.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/asset_paths.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/action_view.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_view/asset_paths.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/error.rb | 3 |
6 files changed, 10 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 0b96c96a2c..8c1f548e47 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -12,7 +12,6 @@ module ActionController autoload :Middleware autoload_under "metal" do - autoload :AssetPaths autoload :Compatibility autoload :ConditionalGet autoload :Cookies diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 0d79e046a1..f829f5e8a2 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 deleted file mode 100644 index 3c1c95c042..0000000000 --- a/actionpack/lib/action_controller/metal/asset_paths.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'action_controller/metal/exceptions' - -module ActionController - module AssetPaths - extend ActiveSupport::Concern - - include AbstractController::AssetPaths - - 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 diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb index 68a2322163..091b0d8cd2 100644 --- a/actionpack/lib/action_view.rb +++ b/actionpack/lib/action_view.rb @@ -71,6 +71,7 @@ module ActionView autoload :MissingTemplate autoload :ActionViewError autoload :EncodingError + autoload :MissingRequestError autoload :TemplateError autoload :WrongEncodingError end 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 <tt>%d</tt> (the number is the source hash mod 4), diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb index f2bef4bded..e00056781d 100644 --- a/actionpack/lib/action_view/template/error.rb +++ b/actionpack/lib/action_view/template/error.rb @@ -8,6 +8,9 @@ module ActionView class EncodingError < StandardError #:nodoc: end + class MissingRequestError < StandardError #:nodoc: + end + class WrongEncodingError < EncodingError #:nodoc: def initialize(string, encoding) @string, @encoding = string, encoding |