<?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>HCoder.org &#187; solution</title>
	<atom:link href="http://hcoder.org/tag/solution/feed/" rel="self" type="application/rss+xml" />
	<link>http://hcoder.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 09 Feb 2012 22:15:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Typo upgrade</title>
		<link>http://hcoder.org/2008/08/07/typo-upgrade/</link>
		<comments>http://hcoder.org/2008/08/07/typo-upgrade/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 21:05:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[typo]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hey there! I have just upgraded Typo. It was slightly traumatic, because at first the blog broke horribly and I couldn&#8217;t see anything other than errors 500. To be fair, the change was quite big, because it included also an upgrade to Rails 2 (I was using some older Typo that used Rails 1.2.x), so [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there!</p>
<p>I have just upgraded Typo. It was slightly traumatic, because at first the blog broke horribly and I couldn&#8217;t see anything other than errors 500. To be fair, the change was quite big, because it included also an upgrade to Rails 2 (I was using some older Typo that used Rails 1.2.x), so everything worked better than expected.</p>
<p>I could login as admin, and change preferences and whatnot, and the only thing that was broken was the public view of the blog. I had a look at the logs, and it complained about not being able to find some template for the sidebars. I was very confused, and didn&#8217;t know where to starting looking for this. So, obviously, I asked &#8220;Señor Google&#8221;. He didn&#8217;t tell me that much, but someone left me the following hint: if you comment out the call to the helper `render_sidebars` (in the active theme code) solved the problem&#8230;. at the price of not having sidebars of course.</p>
<p>So I decided to connect a Ruby/Rails console to the production database, and have a look at the Sidebar model. The summary of what I did is this:</p>
<p>&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
map {|s| s.active_position}<br />
=&gt; [0, 0, 1, 1, 2, 2, 3, 4]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
map {|s| s.type}<br />
=&gt; [nil, &#8220;CategorySidebar&#8221;, nil, &#8220;ArchivesSidebar&#8221;, nil,<br />
&#8220;TagSidebar&#8221;, &#8220;StaticSidebar&#8221;, &#8220;XmlSidebar&#8221;]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
find_all {|s| s.type.nil?}.size<br />
=&gt; 3<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
find_all {|s| s.type.nil?}.each {|s| s.destroy}<br />
=&gt; [#&lt;Sidebar id: 1, active_position: 0, config: {&quot;empty&quot;=&gt;false, &#8220;count&#8221;=&gt;true}, staged_position: nil, type: nil&gt;,<br />
#&lt;Sidebar id: 2, active_position: 1, config: {&quot;title&quot;=&gt;&quot;Links&quot;, &#8220;body&#8221;=&gt;&quot;&#8230;&quot;}, staged_position: nil, type: nil&gt;,<br />
#&lt;Sidebar id: 3, active_position: 2, config: {&quot;format&quot;=&gt;&quot;rss20&quot;, &#8220;trackbacks&#8221;=&gt;true, &#8220;comments&#8221;=&gt;true, &#8220;articles&#8221;=&gt;true}, staged_position: nil, type: nil&gt;]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).find_all {|s| s.type.nil?}.size<br />
=&gt; 0</p>
<p>So, the problem is that there were some (severely broken) leftovers of the upgrade. I just removed them, and everything started working again. Phew!</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=35&amp;md5=8273c1f4c688163cc8faace0e614b85c" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2008/08/07/typo-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=35&amp;md5=8273c1f4c688163cc8faace0e614b85c" type="text/html" />
	</item>
	</channel>
</rss>

