Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 707

Show
Ignore:
Timestamp:
02/20/05 00:02:02 (4 years ago)
Author:
david
Message:

Fixed internal calling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/components.rb

    r706 r707  
    1818     
    1919      def component_class(options) 
    20         options[:controller] ? (options[:controller].camelize + "Controller").constantize : self 
     20        options[:controller] ? (options[:controller].camelize + "Controller").constantize : self.class 
    2121      end 
    2222       
  • trunk/actionpack/test/controller/components_test.rb

    r706 r707  
    1616  def calling_from_template 
    1717    render_template "Ring, ring: <%= render_component(:controller => 'callee', :action => 'being_called') %>" 
     18  end 
     19 
     20  def internal_caller 
     21    render_template "Are you there? <%= render_component(:action => 'internal_callee') %>" 
     22  end 
     23   
     24  def internal_callee 
     25    render_text "Yes, ma'am" 
    1826  end 
    1927 
     
    5967    assert_equal "Ring, ring: Lady of the House, speaking", @response.body 
    6068  end 
     69   
     70  def test_internal_calling 
     71    get :internal_caller 
     72    assert_equal "Are you there? Yes, ma'am", @response.body 
     73  end 
    6174end