diff options
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/url_for.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 96ac138ba3..def28a0054 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -52,7 +52,11 @@ module ActionController class Metal < AbstractController::Base abstract! - attr_internal :env + attr_internal_writer :env + + def env + @_env ||= {} + end # Returns the last part of the controller's name, underscored, without the ending # <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>. diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index c1f1be3bef..e7eb7485c4 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -6,7 +6,7 @@ module ActionController def url_options options = {} - if respond_to?(:env) && env && _routes.equal?(env["action_dispatch.routes"]) + if _routes.equal?(env["action_dispatch.routes"]) options[:script_name] = request.script_name end |