# Include contents of one rhtml in another

**URL:** <https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216>\
**Category:** Rails\
**Created:** [April 19, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216 "2006-04-19T18:11:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asherwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c67d28/32.png) [@asherwood](https://www.ruby-forum.com/u/asherwood)\
**Post date:** [April 19, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216/1 "2006-04-19T18:11:07Z")

</div>

Hi

I have a rhtml documment in views/account/login.rhtml

I want to include the contents of login.rhtml in  
views/welcome/index.rhtml

any suggestions on how this can be done?

Thanks  
Scott

---

<div class="post-metadata">

**Author:** ![asherwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c67d28/32.png) [@asherwood](https://www.ruby-forum.com/u/asherwood)\
**Post date:** [April 19, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216/2 "2006-04-19T18:45:47Z")

</div>

Turn the shared content into a partial. Google ruby rails partials and  
I’m sure you’ll see a ton of demonstrations.

Charlie B.  
[www.recentrambles.com](http://www.recentrambles.com)

---

<div class="post-metadata">

**Author:** ![asherwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c67d28/32.png) [@asherwood](https://www.ruby-forum.com/u/asherwood)\
**Post date:** [April 19, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216/3 "2006-04-19T18:58:06Z")

</div>

You could use a component if you wished. A partial is faster, if you  
can use it.

---

<div class="post-metadata">

**Author:** ![asherwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c67d28/32.png) [@asherwood](https://www.ruby-forum.com/u/asherwood)\
**Post date:** [April 19, 2006, 6:54pm UTC](https://www.ruby-forum.com/t/include-contents-of-one-rhtml-in-another/58216/4 "2006-04-19T18:54:58Z")

</div>

I believe this can also be done by using render\_component - though if  
you  
want to render a login box you’ll probably want to use a partial.
