# Include another action

**URL:** <https://www.ruby-forum.com/t/include-another-action/48602>\
**Category:** Rails\
**Created:** [November 22, 2005, 4:58pm UTC](https://www.ruby-forum.com/t/include-another-action/48602 "2005-11-22T16:58:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jegt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@jegt](https://www.ruby-forum.com/u/jegt)\
**Post date:** [November 22, 2005, 4:58pm UTC](https://www.ruby-forum.com/t/include-another-action/48602/1 "2005-11-22T16:58:15Z")

</div>

Hi

Is there some way in Rails to include (the output of) another action  
in a page? What I am looking for is something like  
RequestDispatcher.include() in Java.

/ Jonas

---

<div class="post-metadata">

**Author:** ![jegt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@jegt](https://www.ruby-forum.com/u/jegt)\
**Post date:** [November 22, 2005, 5:46pm UTC](https://www.ruby-forum.com/t/include-another-action/48602/2 "2005-11-22T17:46:35Z")

</div>

> Is there some way in Rails to include (the output of) another action  
> in a page? What I am looking for is something like  
> RequestDispatcher.include() in Java.

I believe that’s the intention of components:

[http://api.rubyonrails.com/classes/ActionController/Components.html](http://api.rubyonrails.com/classes/ActionController/Components.html)

–

* * *

toddgrimason\*todd[at][slack.net](http://slack.net)

---

<div class="post-metadata">

**Author:** ![jegt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@jegt](https://www.ruby-forum.com/u/jegt)\
**Post date:** [November 22, 2005, 10:08pm UTC](https://www.ruby-forum.com/t/include-another-action/48602/3 "2005-11-22T22:08:25Z")

</div>

On 22 nov 2005, at 17.43, Todd Grimason wrote:

> > Is there some way in Rails to include (the output of) another action  
> > in a page? What I am looking for is something like  
> > RequestDispatcher.include() in Java.
> 
> I believe that’s the intention of components:
> 
> [Peak Obsession](http://api.rubyonrails.com/classes/ActionController/Components.html)

Yes, that is exactly what I was looking for. I wasn’t even looking  
there since I thought it was only for the stuff in the components-dir.

Thanks.

/ Jonas

---

<div class="post-metadata">

**Author:** ![jegt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@jegt](https://www.ruby-forum.com/u/jegt)\
**Post date:** [November 22, 2005, 10:16pm UTC](https://www.ruby-forum.com/t/include-another-action/48602/4 "2005-11-22T22:16:27Z")

</div>

> > Is there some way in Rails to include (the output of) another action
> > 
> > > in a page? What I am looking for is something like  
> > > RequestDispatcher.include() in Java.
> > 
> > I believe that’s the intention of components:
> > 
> > [Peak Obsession](http://api.rubyonrails.com/classes/ActionController/Components.html)
> 
> Yes, that is exactly what I was looking for. I wasn’t even looking  
> there since I thought it was only for the stuff in the components-dir.

keep in mind though:

[http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow](http://railsexpress.de/blog/articles/2005/11/18/components-may-not-be-evil-but-they-sure-can-be-slow)

or

[http://rubyurl.com/Qej](http://rubyurl.com/Qej)

–

* * *

toddgrimason\*todd[at][slack.net](http://slack.net)

---

<div class="post-metadata">

**Author:** ![jegt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@jegt](https://www.ruby-forum.com/u/jegt)\
**Post date:** [November 22, 2005, 5:58pm UTC](https://www.ruby-forum.com/t/include-another-action/48602/5 "2005-11-22T17:58:42Z")

</div>

Have you looked at render\_to\_string ?

- james
