<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Conley&#039;s Blog &#187; multiple partials</title>
	<atom:link href="http://mikeconley.ca/blog/tag/multiple-partials/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikeconley.ca/blog</link>
	<description>The personal blog of a Toronto based software developer, musician, sound designer, and theatre enthusiast.</description>
	<lastBuildDate>Fri, 11 May 2012 15:23:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Rendering Multiple Partials with Ruby on Rails</title>
		<link>http://mikeconley.ca/blog/2009/03/14/rendering-multiple-partials-with-ruby-on-rails/</link>
		<comments>http://mikeconley.ca/blog/2009/03/14/rendering-multiple-partials-with-ruby-on-rails/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 21:03:23 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[multiple partials]]></category>
		<category><![CDATA[partials]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rendering]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=310</guid>
		<description><![CDATA[So, as we speak, I&#8217;m going through a bit of the code that I&#8217;ve submitted for the OLM project, and I&#8217;ve begun refactoring. While doing this, I ran into an interesting problem:  I want to use Rails&#8217; remote_function to update two sections of the page with an AJAX call.  For a while, this stumped me, [...]]]></description>
			<content:encoded><![CDATA[<p>So, as we speak, I&#8217;m going through a bit of the code that I&#8217;ve submitted for the OLM project, and I&#8217;ve begun refactoring.</p>
<p>While doing this, I ran into an interesting problem:  I want to use Rails&#8217; remote_function to update two sections of the page with an AJAX call.  For a while, this stumped me, because you can really only have one render call within a controller method, like this:</p>
<pre>render :partial =&gt; "footer"</pre>
<p>But I was determined to render two.  So here&#8217;s what I ended up doing:</p>
<p>On the client side, I&#8217;ve got this in my view&#8230;</p>
<pre>&lt;%= remote_function (:url =&gt;{ :action =&gt; "codeviewer", :id =&gt; @assignment.id, :uid =&gt; @uid },
                   :with =&gt; "'fid='+fid", :after =&gt; "$('working').hide();")%&gt;</pre>
<p>And in the Controller, in the &#8220;codeviewer&#8221; method, I do this: </p>
<pre>render :update do |page|
    page.replace_html 'codeviewer', :partial =&gt; 'codeviewer', :locals =&gt;
        { :uid =&gt; params[:uid], :filetext =&gt; filetext, :annots =&gt; annots}
      #Also update the annotation_summary_list
    page.replace_html 'annotation_summary_list', :partial =&gt; 'annotation_summary', :locals =&gt; {:annots =&gt; annots, :fid =&gt; @fid}
end</pre>
<p>This will render my two partials in the DOM elements with ID&#8217;s &#8216;codeviewer&#8217; and &#8216;annotation_summary_list&#8217;, respectively.</p>
<p>Nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/03/14/rendering-multiple-partials-with-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

