In my Rails plugin, i want to display multiple view files onto a single page.
Say i want to append some view after the index view.
i am using
<% render :partial => "show" %>
in my index.erb
It works fine. But for better design I want to do the same thing from controller.
So, if i write in my contoller inside the index action
render :partial => "show"
only the show file gets rendered on the page.
Cant I use multiple partials?
Any comments/suggestions, please?
Actually, it would be more ‘true’ to the MVC architecture if that logic remained in the view. I think the cleanest way to do this is to include the partials in your index view using render like you’ve already done.
As far as I’m aware, you cannot ‘append’ views/partials to one another from the controller.