HCoder.org

Typo upgrade

Hey there!

I have just upgraded Typo. It was slightly traumatic, because at first the blog broke horribly and I couldn’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.

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’t know where to starting looking for this. So, obviously, I asked “Señor Google”. He didn’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…. at the price of not having sidebars of course.

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:

Sidebar.find(:all, :order => ‘active_position ASC’). map {|s| s.active_position} => [0, 0, 1, 1, 2, 2, 3, 4] Sidebar.find(:all, :order => ‘active_position ASC’). map {|s| s.type} => [nil, “CategorySidebar”, nil, “ArchivesSidebar”, nil, “TagSidebar”, “StaticSidebar”, “XmlSidebar”] Sidebar.find(:all, :order => ‘active_position ASC’). find_all {|s| s.type.nil?}.size => 3 Sidebar.find(:all, :order => ‘active_position ASC’). find_all {|s| s.type.nil?}.each {|s| s.destroy} => [#<Sidebar id: 1, active_position: 0, config: {“empty”=>false, “count”=>true}, staged_position: nil, type: nil>, #<Sidebar id: 2, active_position: 1, config: {“title”=>”Links”, “body”=>”…”}, staged_position: nil, type: nil>, #<Sidebar id: 3, active_position: 2, config: {“format”=>”rss20”, “trackbacks”=>true, “comments”=>true, “articles”=>true}, staged_position: nil, type: nil>] Sidebar.find(:all, :order => ‘active_position ASC’).find_all {|s| s.type.nil?}.size => 0

So, the problem is that there were some (severely broken) leftovers of the upgrade. I just removed them, and everything started working again. Phew!