Aggregate Controllers

Hi,

I’m developing a dashboard like page and basically want to combine the
result of multiple actions on a page. I’ve done this so far:

def index
r1 = render_to_string :action => “action1”
r2 = render_to_string :action => “action2”

render :text => r1+r2
end

This works, but now I want to render from other controllers and this is
where I’m stuck. So in my current controller lets call it “Dashboard”,
I want to render content from a controller called “HumanResources” and
another controller called “Marketing”. I tried this:

def index
r1 = render_to_string :action => “human_resources/action”
r2 = render_to_string :action => “marketing/action”

render :text => r1+r2
end

This doesn’t work. Any ideas on how from one controller I can get the
output of another controller and include it in the calling controllers
output.

Thanks in advance, scott.

On 7/11/06, Scott W. [email protected] wrote:

render :text => r1+r2

render :text => r1+r2
end

This doesn’t work. Any ideas on how from one controller I can get the
output of another controller and include it in the calling controllers
output.

Thanks in advance, scott.

I’ve never used this method, but in the docs it says it works like a
normal
call to render, and just returns to a string instead of to a browser.

That being the case, would a standard url_for type hash work

r1 = render_to_string :controller => ‘human_resources’, :action =>
‘action’

Don’t know tho…

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