Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7494 from route/actionview_decoupling_issue

ActionView decoupling and sprockets-rails tests fail
  • Loading branch information...
commit 2a95a661cfa5f17f9e2176fd80e8c7389b33fbb0 2 parents 5f99bdb + 3a6e8e4
@drogus drogus authored
View
1  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
View
2  actionpack/lib/action_controller/base.rb
@@ -183,8 +183,8 @@ def self.without_modules(*modules)
MODULES = [
AbstractController::Layouts,
AbstractController::Translation,
+ AbstractController::AssetPaths,
- AssetPaths,
Helpers,
HideActions,
UrlFor,
View
13 actionpack/lib/action_controller/metal/asset_paths.rb
@@ -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
View
1  actionpack/lib/action_view.rb
@@ -71,6 +71,7 @@ module ActionView
autoload :MissingTemplate
autoload :ActionViewError
autoload :EncodingError
+ autoload :MissingRequestError
autoload :TemplateError
autoload :WrongEncodingError
end
View
8 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'
@rafaelfranca Owner

This line will not make Action View depend of Action Pack? I thought the decoupling reason is to make Action View don't depend of Action Pack

@drogus Collaborator
drogus added a note

Yes, totally! I missed that line. It's not needed anymore, fixed here: b243522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
module ActionView
class AssetPaths #:nodoc:
@@ -8,8 +8,6 @@ class AssetPaths #:nodoc:
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 @@ def default_protocol
@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),
View
3  actionpack/lib/action_view/template/error.rb
@@ -8,6 +8,9 @@ class ActionViewError < StandardError #:nodoc:
class EncodingError < StandardError #:nodoc:
end
+ class MissingRequestError < StandardError #:nodoc:
+ end
+
class WrongEncodingError < EncodingError #:nodoc:
def initialize(string, encoding)
@string, @encoding = string, encoding
Please sign in to comment.
Something went wrong with that request. Please try again.