# Instantiating new engine controller?

**URL:** <https://www.ruby-forum.com/t/instantiating-new-engine-controller/105097>\
**Category:** Engines\
**Created:** [May 25, 2007, 7:20pm UTC](https://www.ruby-forum.com/t/instantiating-new-engine-controller/105097 "2007-05-25T19:20:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Hassman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@Marc\_Hassman](https://www.ruby-forum.com/u/Marc_Hassman)\
**Post date:** [May 25, 2007, 7:20pm UTC](https://www.ruby-forum.com/t/instantiating-new-engine-controller/105097/1 "2007-05-25T19:20:24Z")

</div>

I am trying to do some dynamic instantiation trickery and have found  
success, up to  
the point where my view is to be rendered. When I call an action and let  
the new  
controller render, it tries to render out of the application and doesn’t  
give any  
indication that it knows about the engine view paths.

Do I need to set/require/include something in the instantiated  
controller so it knows  
about engine views?

Thanks,  
Marc

---

<div class="post-metadata">

**Author:** ![Marc\_Hassman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@Marc\_Hassman](https://www.ruby-forum.com/u/Marc_Hassman)\
**Post date:** [May 27, 2007, 5:48am UTC](https://www.ruby-forum.com/t/instantiating-new-engine-controller/105097/2 "2007-05-27T05:48:12Z")

</div>

I just tried something like

app/  
controllers/some\_controller.rb:  
def a  
render :template =\> ‘b/c’  
end  
vendor/plugins/some\_pugin/  
app/views/b  
c.rhtml:  
some value in c’s template

And low and behold it doesn’t work (it looks for  
app/views/main/b/c.rhtml).

But, if you render a plugin’s partial, like this:

app/  
controllers/some\_controller.rb  
views/  
a.rhtml:  
render :partial =\> ‘b/c’  
vendor/plugins/some\_plugin/  
app/views/b  
\_c.rhtml  
some value in c partial

It should work.

-Andrew R.

Marc Hassman wrote:

> I am trying to do some dynamic instantiation trickery and have found  
> success, up to  
> the point where my view is to be rendered. When I call an action and let  
> the new  
> controller render, it tries to render out of the application and doesn’t  
> give any  
> indication that it knows about the engine view paths.
> 
> Do I need to set/require/include something in the instantiated  
> controller so it knows  
> about engine views?
> 
> Thanks,  
> Marc

---

<div class="post-metadata">

**Author:** ![Marc\_Hassman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@Marc\_Hassman](https://www.ruby-forum.com/u/Marc_Hassman)\
**Post date:** [May 29, 2007, 5:54pm UTC](https://www.ruby-forum.com/t/instantiating-new-engine-controller/105097/3 "2007-05-29T17:54:53Z")

</div>

Hi Marc,

You shouldn’t need to do anything for this to work, so this is  
interesting! You may want to investigate what full\_template\_path is  
returning from within your dynamic controller…

James
