Merb, jQuery and Nitobi | August 29th, 2008
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:
params[:file][:tempfile]
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.
August 29th, 2008 at 5:58 pm
Very interesting. We are also experimenting in house with Merb (learning Ruby as well). It was great to hear your experiences and knowing that other people are playing with Merb too.
Also, these Nitobi components look pretty slick, I’ll have to take a look at them too. We are practically neighbours so perhaps we will see you around sometime.
October 16th, 2008 at 1:33 am
hi there great work i know this question is out of this bloq but since i read you had the same problem with jquiry conflicts i have the same.
i am using combobox on a page where jquiry is used. if i dont use (noConflict ) the combo box will now show up if i do use noConflit the combo box shows up but i get alot of errors on explorer.
Any idea how i can solve this problem. the webstie is
http://www.needme.com.au
cheers
October 17th, 2008 at 1:53 pm
It’s recently become common practice to use jQuery.noConflict in all your jQuery javascript. As for other errors with ComboBox and jQuery, I would highly recommend contacting [email protected] and sending our support person the info.