From 1aadafda8dd28ec081da6827878003c478c77c76 Mon Sep 17 00:00:00 2001 From: Yehuda Katz and Carl Lerche Date: Wed, 8 Apr 2009 17:32:19 -0700 Subject: Updated old AC::Base for small changes to AV --- actionpack/lib/action_controller/base/base.rb | 2 +- actionpack/lib/action_controller/dispatch/dispatcher.rb | 1 - actionpack/lib/action_view/base.rb | 3 ++- actionpack/lib/action_view/render/rendering.rb | 2 +- actionpack/test/controller/base_test.rb | 2 ++ activesupport/lib/active_support/memoizable.rb | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/actionpack/lib/action_controller/base/base.rb b/actionpack/lib/action_controller/base/base.rb index 29d87d8125..7a745ea040 100644 --- a/actionpack/lib/action_controller/base/base.rb +++ b/actionpack/lib/action_controller/base/base.rb @@ -832,7 +832,7 @@ module ActionController #:nodoc: begin default_render rescue ActionView::MissingTemplate => e - raise e unless e.path == action_name + raise e unless e.action_name == action_name # If the path is the same as the action_name, the action is completely missing raise UnknownAction, "No action responded to #{action_name}. Actions: " + "#{action_methods.sort.to_sentence}", caller diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb index df77e22204..e205245f13 100644 --- a/actionpack/lib/action_controller/dispatch/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb @@ -64,7 +64,6 @@ module ActionController run_callbacks :before_dispatch Routing::Routes.call(@env) rescue Exception => exception - raise exception if controller ||= (::ApplicationController rescue Base) controller.call_with_exception(@env, exception).to_a else diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 2f7cfeb88e..ada9052073 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -3,10 +3,11 @@ module ActionView #:nodoc: end class MissingTemplate < ActionViewError #:nodoc: - attr_reader :path + attr_reader :path, :action_name def initialize(paths, path, template_format = nil) @path = path + @action_name = path.split("/").last.split(".")[0...-1].join(".") full_template_path = path.include?('.') ? path : "#{path}.erb" display_paths = paths.compact.join(":") template_type = (path =~ /layouts/i) ? 'layout' : 'template' diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 68b343de77..2d8bdab100 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -79,7 +79,7 @@ module ActionView @_render_stack.pop result rescue Exception => e - raise e if !template.filename || template.is_a?(InlineTemplate) + raise e if template.is_a?(InlineTemplate) || !template.filename if TemplateError === e e.sub_template_of(template) raise e diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index 9523189f41..f4517d06c4 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -170,6 +170,7 @@ class DefaultUrlOptionsTest < ActionController::TestCase tests DefaultUrlOptionsController def setup + super @request.host = 'www.example.com' rescue_action_in_public! end @@ -193,6 +194,7 @@ class EmptyUrlOptionsTest < ActionController::TestCase tests NonEmptyController def setup + super @request.host = 'www.example.com' rescue_action_in_public! end diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb index bd9dbb60fc..945c1a68bb 100644 --- a/activesupport/lib/active_support/memoizable.rb +++ b/activesupport/lib/active_support/memoizable.rb @@ -82,7 +82,7 @@ module ActiveSupport if instance_method(:#{symbol}).arity == 0 # if instance_method(:mime_type).arity == 0 def #{symbol}(reload = false) # def mime_type(reload = false) if reload || !defined?(#{memoized_ivar}) || #{memoized_ivar}.empty? # if reload || !defined?(@_memoized_mime_type) || @_memoized_mime_type.empty? - #{memoized_ivar} = [#{original_method}.freeze] # @_memoized_mime_type = [_unmemoized_mime_type.freeze] + #{memoized_ivar} = [#{original_method}] # @_memoized_mime_type = [_unmemoized_mime_type] end # end #{memoized_ivar}[0] # @_memoized_mime_type[0] end # end @@ -95,7 +95,7 @@ module ActiveSupport if !reload && #{memoized_ivar}.has_key?(args) # if !reload && @_memoized_mime_type.has_key?(args) #{memoized_ivar}[args] # @_memoized_mime_type[args] elsif #{memoized_ivar} # elsif @_memoized_mime_type - #{memoized_ivar}[args] = #{original_method}(*args).freeze # @_memoized_mime_type[args] = _unmemoized_mime_type(*args).freeze + #{memoized_ivar}[args] = #{original_method}(*args) # @_memoized_mime_type[args] = _unmemoized_mime_type(*args) end # end else # else #{original_method}(*args) # _unmemoized_mime_type(*args) -- cgit v1.2.3