Forum: Ruby on Rails Controller call with "process" fails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Christian S. (Guest)
on 2007-04-16 13:17
Hi Folks,

I have a active_scaffold based controller that should diplay something
like a dynamic result list.

For the dynamic part I created a special controller that gets
initialized within the index method of my first controller. After the
initialization I want to use the list action of my dynamic controller
and diplay the result of the dynamic controller as the result of my
current controller.

What I do is this:

  def index
    params[:action] = "list"
    dynCtrl = DynamicController.new(_some_fancy_params_)
    dynCtrl.process(request, response)
  end

But instead of getting the expected result of my dynamic controller I
get a "Template is missing ...index.rhtml" error.

When I add the missing file index.rhtml I get the content of this file
instead of the expected result list. I checked the return of my index
and it looks like a perfectly filled ActionController::CgiResponse with
the expected body comes back but it does not get displayed in the end.

What am I missing?

Thanks & Regards,

Christian
Christian S. (Guest)
on 2007-04-16 13:35
Hi again,

figured it out myself. I only had to add:

    render :text => dyn_response.body.to_s

And now I can see the expected result!

Chris

Christian S. wrote:
> Hi Folks,
>
> I have a active_scaffold based controller that should diplay something
> like a dynamic result list.
>
> For the dynamic part I created a special controller that gets
> initialized within the index method of my first controller. After the
> initialization I want to use the list action of my dynamic controller
> and diplay the result of the dynamic controller as the result of my
> current controller.
>
> What I do is this:
>
>   def index
>     params[:action] = "list"
>     dynCtrl = DynamicController.new(_some_fancy_params_)
>     dynCtrl.process(request, response)
>   end
>
> But instead of getting the expected result of my dynamic controller I
> get a "Template is missing ...index.rhtml" error.
>
> When I add the missing file index.rhtml I get the content of this file
> instead of the expected result list. I checked the return of my index
> and it looks like a perfectly filled ActionController::CgiResponse with
> the expected body comes back but it does not get displayed in the end.
>
> What am I missing?
>
> Thanks & Regards,
>
> Christian
This topic is locked and can not be replied to.