# Calling partials from public/\*.html?

**URL:** <https://www.ruby-forum.com/t/calling-partials-from-public-html/79245>\
**Category:** Rails\
**Created:** [March 9, 2006, 10:16pm UTC](https://www.ruby-forum.com/t/calling-partials-from-public-html/79245 "2006-03-09T22:16:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 9, 2006, 10:16pm UTC](https://www.ruby-forum.com/t/calling-partials-from-public-html/79245/1 "2006-03-09T22:16:07Z")

</div>

Can I call partials from html files in public?

Is this wise?

I’ve got a bunch of html files and I’d like to let them have access to  
pieces of Rails, but I’d like to manage them through Contribute or  
some such.

I could wiki them up, but that seems like a lot of work for pages that  
don’t get updated that often (yearly or so).

Thanks in advance!

- Dave

–  
David H.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 9, 2006, 10:28pm UTC](https://www.ruby-forum.com/t/calling-partials-from-public-html/79245/2 "2006-03-09T22:28:20Z")

</div>

On 3/9/06, David H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can I call partials from html files in public?
> 
> Is this wise?

You probably could, but it wouldn’t be easy.

I don’t know how many files you’d have to change, but I can’t imagine it  
being worth the effort.

– Joshua

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 9, 2006, 11:01pm UTC](https://www.ruby-forum.com/t/calling-partials-from-public-html/79245/3 "2006-03-09T23:01:57Z")

</div>

> > Can I call partials from html files in public?

> You probably could, but it wouldn’t be easy.
> 
> I don’t know how many files you’d have to change

it’s easy, and none. see public/index.html in a fresh 1.1/trunk  
install… it already dynamically updates part of the page…

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 9, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/calling-partials-from-public-html/79245/4 "2006-03-09T23:04:59Z")

</div>

It actually wouldnt be that hard. Not sure the correct syntax, but  
something  
like:

def render\_something(something)  
IO.read("#{RAILS\_ROOT}/public/#{somthing}")  
end  
(again syntax may be off, but the idea is the same)

This simply reads the HTML file (or whatever something is) and returns  
it.  
Put this in application.rb and you can now render anything in your  
public  
folder.

-Nick
