Merb, jQuery and Nitobi

Recently, we reached a milestone with our first Merb project. The project was interesting, since it was the largest Merb app that we had to deal with. The good thing about Merb was the fact that it's lightweight, and gives you a sense of what you're actually using as opposed to Rails, which is full of methods that I just don't use. I also like the way file uploads are just handled in Merb, as opposed to the Rails way, which is far more cryptic.

The fact that whenever you post data, it just goes to the following parameter:


Is extremely handy, since this doesn't have to be handled like the good old ruby way of handling blob data through your app. You still have to move the file, but you aren't just being handed some weird data in memory and expected to use something to process it. This is why people use plugins like attachment_fu and things like that. The less your web app is handling that sort of data, the more requests that it can handle, and the more things it can get done.

Of course, that's the whole point of Merb. Admittedly, we don't take advantage of this as much as we could have in this project. We have Rails projects that handle hundreds of uploads that would probably be more suited for Merb, but of course hindsight is almost always 20/20 and it's time to move on to talk about jQuery and Nitobi Toolkit.

Since this was an experimental project of sorts, I decided to try out jQuery to see what all the hype was about. jQuery is a nice little framework that makes doing simple things like Ajax requests easy. Attaching events to classes is handy, and that is the fundamental strength of the framework. Also, using jQuery UI was interesting as well. While making things appear and disappear was easy, some of the components tended to be ugly, and lacked functionality, so we decided to use Nitobi Calendar instead of the jQuery calendar early on.

This brought us into bringing in Nitobi Toolkit and Nitobi Calendar and making it play nice with jQuery. We learned the number one thing about jQuery, which is that you should always use noConflict if you believe that you are going to use more than one framework. In our case, we use both the Calendar and the Nitobi History object, simply because of the lack of examples of the jQuery.history object, and the fact that it relied on Anchor tags in the examples. It wasn't clear if we could custom define the URI behind the scenes, and use that instead of something defined in the markup, which is exactly what we wanted to do.

Therefore, we used Toolkit's history method, and it worked rather well. I may check out jQuery's History add-on library, but the Nitobi history comes standard in Complete UI and is rather easy to use. There will be some tweaks to it in the next version of CUI.

In short, it was an interesting expeirence working on the project, and being able to work with Merb. I'm definitely going to move towards Merb, and it should be good when Merb 1.0 comes out at MerbCamp in San Diego. Unfortunately, it's at the same time as Canadian Thanksgiving, but there may be at least one person from Nitobi present.

There may not necessarily be a MerbDog soon, but It's definitely my first choice for any new personal web projects that I do.