# iain.nl  

The Knights Templater part II: Priory of Haml

Written on

Of course it's no problem to upgrade from Ruby on Rails 1.2.6 to 2.0.2. Just make sure you don't fuck up your subversion when unfreezing the old and freezing the new version. I just wanted to have that out of the way, before starting this new adventure.

My current project (not being the same as the one from my previous post about the knights templater) in which I totally wrote **123 **views, of which **48 **partials. Since this project was so Agile, it would have made fucking of the ugly fat girl from some party look like it had been planned and completely documented months in advance, it has become a jungle of views rendering partials rendering partials rendering partials. The HTML had come from the templaters, the functionality is all finished. All we (Arie and me) need to do now is completely reimplement all the views. Yuck!

Haml has been popping op often lately in my feed reader. It certainly gets the community talking, but no-one really implements it just yet. I heard Obie Fernandez's new company HashRocket is using it. And since I'm still an intern studying Ruby on Rails, this seemed the best moment to try it out for real.

But why Haml? Isn't there a faster way? A way to use the HTML done by the templaters? Well, no not really. Because all templates are more ruby code than HTML anyway. It has more "If I have one object of this, render that, or else, render that. If you have none of that, replace this with that and show this message". So much for separating Ruby code from HTML. In this project there is much more display logic than application logic and although I have about a dozen fully packed helpers, it can only go so far.

So we had to redo the site anyhow. It would be two weeks of sifting HTML from our old templates and replacing it with our new templates, putting in the ruby code again. Almost the same as retyping it all. So if I am going to be retyping it all, I want it to be fast. Let's put Haml to the test!