ruby on rails - Merging multiple partials before rendering -
both partials below elements of table , have same structure. wish merge these 2 partials first , render them ajax call. possible?
def refreshprojects @projects = project.get(params[:username]) render :partial => "project.elements.data", :locals => {:projects=>@projects } render :partial => "project.shared.elements.data", :locals => {:projects=>@projects_shared } end
considering @projects , @shared_projects array, can pass on them combined single array 1 of partials instead of doing individually.
render :partial => "project.elements.data", :locals => { :projects=> @projects + @projects_shared }
in case, if there difference in partials ui, can call 2 in view name of action, i.e., refreshprojects.html.erb
, remove 2 lines action.
render :partial => "project.elements.data", :locals => {:projects=>@projects }
render :partial => "project.shared.elements.data", :locals => {:projects=>@projects_shared }
Comments
Post a Comment