views:

52

answers:

4

How do I render a view within another view... in rails... is it possible?

+1  A: 

Use view partials

See section 3.4 http://guides.rubyonrails.org/layouts_and_rendering.html

Larry K
thanks that worked!
Madhusudhan
+2  A: 

A complete view inside another a view? Normally the way you would handle something like this in rails would be with partials.

Create a set of shared partials, and then just render them in each of the views.

Doon
+2  A: 
#hotdog_controller
def show
  # by default renders template hotdog/show.html.erb
end

#hotdog/show.html.erb
<%= render :template => 'ketchup' -%>
mark
A: 

I do the same thing a few times, but I load the sub views in through AJAX. And that AJAX is instantiated within the partial.

Trip