Instantiating new engine controller?

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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs