Fixed internal calling

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@707 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-02-20 00:02:02 +00:00
parent cf6d77600a
commit acb3d2cf75
2 changed files with 14 additions and 1 deletions

View File

@ -17,7 +17,7 @@ module ActionController #:nodoc:
end
def component_class(options)
options[:controller] ? (options[:controller].camelize + "Controller").constantize : self
options[:controller] ? (options[:controller].camelize + "Controller").constantize : self.class
end
def component_request(options)

View File

@ -17,6 +17,14 @@ class CallerController < ActionController::Base
render_template "Ring, ring: <%= render_component(:controller => 'callee', :action => 'being_called') %>"
end
def internal_caller
render_template "Are you there? <%= render_component(:action => 'internal_callee') %>"
end
def internal_callee
render_text "Yes, ma'am"
end
def rescue_action(e) raise end
end
@ -58,4 +66,9 @@ class RenderTest < Test::Unit::TestCase
get :calling_from_template
assert_equal "Ring, ring: Lady of the House, speaking", @response.body
end
def test_internal_calling
get :internal_caller
assert_equal "Are you there? Yes, ma'am", @response.body
end
end