# How to render template in behavior file?

**URL:** <https://www.ruby-forum.com/t/how-to-render-template-in-behavior-file/77512>\
**Category:** Radiant CMS\
**Created:** [November 28, 2006, 3:23pm UTC](https://www.ruby-forum.com/t/how-to-render-template-in-behavior-file/77512 "2006-11-28T15:23:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Lomakin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Alexander\_Lomakin](https://www.ruby-forum.com/u/Alexander_Lomakin)\
**Post date:** [November 28, 2006, 3:23pm UTC](https://www.ruby-forum.com/t/how-to-render-template-in-behavior-file/77512/1 "2006-11-28T15:23:06Z")

</div>

Hello everybody.

I have one question. I want to render template from behavior file. For  
example:

class CarObserverBehavior \< Behavior::Base

register “Car Observer”

def render\_page  
render :template =\> ‘mytemplates/gootemplate’  
end

def cache\_page?  
false  
end  
end

Of course this code will be executed with an error. Somebody knows  
alternative for " render :template =\> ‘mytemplates/gootemplate’ "  
code? It is possible?

–  
Best wishes, Alexander Lomakin.

---

<div class="post-metadata">

**Author:** ![Alexander\_Lomakin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Alexander\_Lomakin](https://www.ruby-forum.com/u/Alexander_Lomakin)\
**Post date:** [November 28, 2006, 3:41pm UTC](https://www.ruby-forum.com/t/how-to-render-template-in-behavior-file/77512/2 "2006-11-28T15:41:09Z")

</div>

Alexander Lomakin wrote:

> Of course this code will be executed with an error. Somebody knows  
> alternative for " render :template =\> ‘mytemplates/gootemplate’ "  
> code? It is possible?

It’s not presently possible. Why would you consider this behavior  
desirable?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![Alexander\_Lomakin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Alexander\_Lomakin](https://www.ruby-forum.com/u/Alexander_Lomakin)\
**Post date:** [November 28, 2006, 10:19pm UTC](https://www.ruby-forum.com/t/how-to-render-template-in-behavior-file/77512/3 "2006-11-28T22:19:08Z")

</div>

John W. Long wrote:

> Alexander Lomakin wrote:
> 
> > Of course this code will be executed with an error. Somebody knows  
> > alternative for " render :template =\> ‘mytemplates/gootemplate’ "  
> > code? It is possible?
> 
> It’s not presently possible. Why would you consider this behavior  
> desirable?

It looks like he wants to use a Layout from a file instead of using one  
of the Layouts defined in the database. (via radiant admin)

This would allow you yo use a text editor while your messing with a  
layout instead of working within the textarea radiant provides. It  
should be possible with a little bit of hackery…

Am I right about what you are trying to do Alexander?
