# Render HTML in RHTML

**URL:** <https://www.ruby-forum.com/t/render-html-in-rhtml/107000>\
**Category:** Rails\
**Created:** [June 16, 2007, 8:49am UTC](https://www.ruby-forum.com/t/render-html-in-rhtml/107000 "2007-06-16T08:49:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 16, 2007, 8:49am UTC](https://www.ruby-forum.com/t/render-html-in-rhtml/107000/1 "2007-06-16T08:49:32Z")

</div>

Hai guys  
I have one question to all the experts in Rails  
That question is ,I have one HTML file with some css attached in my  
rails root.  
I need to display that HTML file in our RHTML file  
can you tell me the answer?  
Ok  
Bye  
By  
P.S.Hussain

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 16, 2007, 9:47am UTC](https://www.ruby-forum.com/t/render-html-in-rhtml/107000/2 "2007-06-16T09:47:05Z")

</div>

What you really need is your html file moved somewhere under app/  
views, renamed to \_htmlfile.rhtml and rendered as partial in your  
rhtml template, like \<%= render :partial =\> ‘htmlfile’ %\> or  
something. Possibly, but unlikely, I am missing some very unusual need  
to keep things as you did, more detailed explanation would help make  
things clearer. Don’t try to provide abstract description, better try  
to be as specific as it ever possible, or you’ll get lots of answers  
barely applicable to your case.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 16, 2007, 9:47am UTC](https://www.ruby-forum.com/t/render-html-in-rhtml/107000/3 "2007-06-16T09:47:05Z")

</div>

The problem as stated is harder than it needs to be. If the HTML  
content could be placed in a file under the views directory tree, and  
the name starts with an “\_” then just render :partial =\> …

If it needs to reside there you can always provide the full path name  
to the render method, or use render :text =\> … after reading the  
file into memory.

Michael
