Skip to content

Commit

Permalink
Updated old AC::Base for small changes to AV
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Apr 9, 2009
1 parent 6c05b5e commit 1aadafd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/base/base.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def perform_action
begin begin
default_render default_render
rescue ActionView::MissingTemplate => e 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 # If the path is the same as the action_name, the action is completely missing
raise UnknownAction, "No action responded to #{action_name}. Actions: " + raise UnknownAction, "No action responded to #{action_name}. Actions: " +
"#{action_methods.sort.to_sentence}", caller "#{action_methods.sort.to_sentence}", caller
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/dispatch/dispatcher.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def dispatch
run_callbacks :before_dispatch run_callbacks :before_dispatch
Routing::Routes.call(@env) Routing::Routes.call(@env)
rescue Exception => exception rescue Exception => exception
raise exception
if controller ||= (::ApplicationController rescue Base) if controller ||= (::ApplicationController rescue Base)
controller.call_with_exception(@env, exception).to_a controller.call_with_exception(@env, exception).to_a
else else
Expand Down
3 changes: 2 additions & 1 deletion actionpack/lib/action_view/base.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ class ActionViewError < StandardError #:nodoc:
end end


class MissingTemplate < ActionViewError #:nodoc: class MissingTemplate < ActionViewError #:nodoc:
attr_reader :path attr_reader :path, :action_name


def initialize(paths, path, template_format = nil) def initialize(paths, path, template_format = nil)
@path = path @path = path
@action_name = path.split("/").last.split(".")[0...-1].join(".")
full_template_path = path.include?('.') ? path : "#{path}.erb" full_template_path = path.include?('.') ? path : "#{path}.erb"
display_paths = paths.compact.join(":") display_paths = paths.compact.join(":")
template_type = (path =~ /layouts/i) ? 'layout' : 'template' template_type = (path =~ /layouts/i) ? 'layout' : 'template'
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/render/rendering.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _render_template(template, local_assigns = {})
@_render_stack.pop @_render_stack.pop
result result
rescue Exception => e rescue Exception => e
raise e if !template.filename || template.is_a?(InlineTemplate) raise e if template.is_a?(InlineTemplate) || !template.filename
if TemplateError === e if TemplateError === e
e.sub_template_of(template) e.sub_template_of(template)
raise e raise e
Expand Down
2 changes: 2 additions & 0 deletions actionpack/test/controller/base_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class DefaultUrlOptionsTest < ActionController::TestCase
tests DefaultUrlOptionsController tests DefaultUrlOptionsController


def setup def setup
super
@request.host = 'www.example.com' @request.host = 'www.example.com'
rescue_action_in_public! rescue_action_in_public!
end end
Expand All @@ -193,6 +194,7 @@ class EmptyUrlOptionsTest < ActionController::TestCase
tests NonEmptyController tests NonEmptyController


def setup def setup
super
@request.host = 'www.example.com' @request.host = 'www.example.com'
rescue_action_in_public! rescue_action_in_public!
end end
Expand Down
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/memoizable.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def memoize(*symbols)
if instance_method(:#{symbol}).arity == 0 # if instance_method(:mime_type).arity == 0 if instance_method(:#{symbol}).arity == 0 # if instance_method(:mime_type).arity == 0
def #{symbol}(reload = false) # def mime_type(reload = false) 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? 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 end # end
#{memoized_ivar}[0] # @_memoized_mime_type[0] #{memoized_ivar}[0] # @_memoized_mime_type[0]
end # end end # end
Expand All @@ -95,7 +95,7 @@ def #{symbol}(*args) # def m
if !reload && #{memoized_ivar}.has_key?(args) # if !reload && @_memoized_mime_type.has_key?(args) if !reload && #{memoized_ivar}.has_key?(args) # if !reload && @_memoized_mime_type.has_key?(args)
#{memoized_ivar}[args] # @_memoized_mime_type[args] #{memoized_ivar}[args] # @_memoized_mime_type[args]
elsif #{memoized_ivar} # elsif @_memoized_mime_type 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 end # end
else # else else # else
#{original_method}(*args) # _unmemoized_mime_type(*args) #{original_method}(*args) # _unmemoized_mime_type(*args)
Expand Down

0 comments on commit 1aadafd

Please sign in to comment.