How do I render a view within another view... 开发者_如何学Goin rails... is it possible?
#hotdog_controller
def show
# by default renders template hotdog/show.html.erb
end
#hotdog/show.html.erb
<%= render :template => 'ketchup' -%>
Use view partials
See section 3.4 http://guides.rubyonrails.org/layouts_and_rendering.html
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.
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.
精彩评论