# File path from controller

**URL:** <https://www.ruby-forum.com/t/file-path-from-controller/110487>\
**Category:** Rails\
**Created:** [July 26, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/file-path-from-controller/110487 "2007-07-26T20:13:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonlog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jonlog](https://www.ruby-forum.com/u/jonlog)\
**Post date:** [July 26, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/file-path-from-controller/110487/1 "2007-07-26T20:13:05Z")

</div>

I’m trying to load an .html file from my /public directory using Hpricot  
in one of my controllers.

Ex: doc = Hpricot(open(’/template\_1.htm’))

This can’t seem to find the file and it only works if I use the full,  
absolute url which is unacceptable since there will be many different  
sub-domains. How can I correctly reference a file in the /public  
directory? Is there some type of root constant I can prepend to this?  
Thanks.
