# Dynamic view - is it possible at all?

**URL:** <https://www.ruby-forum.com/t/dynamic-view-is-it-possible-at-all/115240>\
**Category:** Rails\
**Created:** [September 22, 2007, 6:03am UTC](https://www.ruby-forum.com/t/dynamic-view-is-it-possible-at-all/115240 "2007-09-22T06:03:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![inrila](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a3d4f5/32.png) [@inrila](https://www.ruby-forum.com/u/inrila)\
**Post date:** [September 22, 2007, 6:03am UTC](https://www.ruby-forum.com/t/dynamic-view-is-it-possible-at-all/115240/1 "2007-09-22T06:03:25Z")

</div>

I have the following question. It sounds weird, but still.

We all have app/views/say.rhtml or any other template for the view. It  
can include of course instructions in \<% %\>  
So the question is next – is it possible to use .rhtml as a view  
which we just uploaded?

I.e. user uploads his own .rhtml, controller saves it in the database,  
and shows the view using it.

Is it possible at all?

Thanks!

---

<div class="post-metadata">

**Author:** ![inrila](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a3d4f5/32.png) [@inrila](https://www.ruby-forum.com/u/inrila)\
**Post date:** [September 22, 2007, 6:08am UTC](https://www.ruby-forum.com/t/dynamic-view-is-it-possible-at-all/115240/2 "2007-09-22T06:08:26Z")

</div>

inrila wrote:

> I.e. user uploads his own .rhtml, controller saves it in the database,  
> and shows the view using it.
> 
> Is it possible at all?

If you don’t mind the security nightmare, just use

render :inline =\> MyModel.find(:whatever).your\_rhtml

Because that’s so high risk, even for internal development we use Lilu.  
Our  
graphic artists upload raw HTML, and Lilu installs the template stuff  
based  
only on id and class selectors into that HTML.

–  
Phlip

---

<div class="post-metadata">

**Author:** ![inrila](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a3d4f5/32.png) [@inrila](https://www.ruby-forum.com/u/inrila)\
**Post date:** [September 22, 2007, 11:00am UTC](https://www.ruby-forum.com/t/dynamic-view-is-it-possible-at-all/115240/3 "2007-09-22T11:00:46Z")

</div>

Another way of doing this is with Liquid. It powers the Shopify commerce  
system.

> **[Liquid template language](https://shopify.github.io/liquid/)**
>
> Documentation for the Liquid template language, created by Shopify.

On 9/21/07, Phlip [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> >

–  
Nathaniel Steven Henry Brown  
604-724-6624
