Module ActionController::Components
In: vendor/rails/actionpack/lib/action_controller/components.rb

Components allows you to call other actions for their rendered response while execution another action. You can either delegate the entire response rendering or you can mix a partial response in with your other content.

  class WeblogController < ActionController::Base
    # Performs a method and then lets hello_world output its render
    def delegate_action
      do_other_stuff_before_hello_world
      render_component :controller => "greeter",  :action => "hello_world", :params => { "person" => "david" }
    end
  end

  class GreeterController < ActionController::Base
    def hello_world
      render_text "#{@params['person']} says, Hello World!"
    end
  end

The same can be done in a view to do a partial rendering:

  Let's see a greeting:
  <%= render_component :controller => "greeter", :action => "hello_world" %>

Methods

Public Instance methods

[Source]

    # File vendor/rails/actionpack/lib/action_controller/components.rb, line 27
27:         def render_component(options) 
28:           @controller.send(:render_component_as_string, options)
29:         end

Protected Instance methods

Renders the component specified as the response for the current method

[Source]

    # File vendor/rails/actionpack/lib/action_controller/components.rb, line 35
35:       def render_component(options = {}) #:doc:
36:         component_logging(options) { render_text(component_response(options).body, response.headers["Status"]) }
37:       end

Returns the component response as a string

[Source]

    # File vendor/rails/actionpack/lib/action_controller/components.rb, line 40
40:       def render_component_as_string(options) #:doc:
41:         component_logging(options) { component_response(options, false).body }
42:       end

[Validate]