Balancing On Rails

August 01, 2007


I have no idea why I18N is not implemented either in Ruby or in Rails. I know the only argument that applies to it is that Ruby is still not 2.0. So we should not be expecting many advanced features in Ruby.

Granted that, I think we are in 2007, not in 1997. I can understand if Ruby came out in 1997 and didn't have I18N, it was acceptable. Because web applications were not popular that time.

But we are in 2007 and Ruby on Rails is touted as the best framework available for building web based applications. While we are fighting about scalability of Ruby on Rails for a large scale web application, I am surprised that people are not talking about internationalization.

Yes, there are two plug-ins available for I18N. One is Globalize and other is Globalite. While Globalize is the heavy one, but I disliked it because of the feature that it uses database to store the strings. Coming from Java where resources are stored in a text file and parsed while the application is loaded, always seemed a good idea. I don't want to use database because I don't want my application to connect to database for every string that it wants to internationalized.

Globalite is a lighter model, but the documentation is very poor and I never had a clue how and where I would be setting up the locale information. If anybody can point me in the right direction, I would appreciate that.

Given all that, I am surprised that nobody raises any concern about I18N. If anybody has developed a large scale web based application, that person knows that it's really painful to integrate I18N in a later stage because one has to go inside each file to find out where the text strings are and convert them to appropriate API calls. So it's always advised that I18N should be an important consideration at the beginning of the project. The worst is

puts [ "ant" , "bat" , "cat" ].to_sentence #=> "ant, bat, and cat"

Tell me that when I18N is in place, this API would write "and" in appropriate language. Because that is going to be undetectable in many web application!

Removing a controller

Rails does a lot of automation to generate controllers etc. For an example if you are creating a controller, all you need to do is:

ruby script/generate controller some

This would generate a lot of things like

  • creates a director called some under views
  • creates a file called some_controller.rb under app/controllers directory.
  • creates a file called some_controller_test.rb test/functional directory.
  • creates a file called admin_helper.rb under app/helpers directory.

All this is fine. But let's say I created this controller and later I don't want this controller. I want to remove it. How do I remove it? Is there a automation command that would go through and remove the files for me?

Technorati tags: , ,

Agile Web Development with Rails : The book

After reading the pickaxe book on Ruby, I moved on to reading the book "Agile Web Development with Rails". The book should be the first book you should read when you are gearing up for Rails and you better buy this book because you are going to read that book until all the pages are torn. Every now and then you would turn back to the book to get more information.

However, the book should be read from back to front. Yes, it first lets you jump start on creating a web application using rails. But when I went through it, I just read it like a fiction. I am not that sort of a guy who starts reading the book while having a computer next to him and starts working on the sample application. I am kind of a guy who wants to know the internal details first and then start writing the application. I don't know that's a good way to read a book or not. But that's how I am.

So I was kind of getting disappointed while going through the creation of the "Depot" application that I was not getting enough information about Rails. But when I started reading Part III (Rails Framework), that's where I found the book to be interesting and worth reading. And I can tell you this for sure, you better read every chapter in Part II more than once. Because there is so much information on each page that it would be hard to grasp everything on one read.

This is the only book that is needed for Rails! 

Technorati tags: ,