Rails options_from_collection_for_select with custom attributes for each option

You probably already know that you can use options_from_collection_for_select helper method generate <option></option> from a collection. If you are unaware of it, you can check this api documentation.

It helped me greatly until I needed some custom attributes to each <option></option> which will be used by jQuery for doing some tasks in UI level. Custom attributes will help me by reducing server calls for getting those information. However, I did not find a way set custom attributes with the above helper method. So, I’ve made a basic version of my own (if you prefer, you can override the original method). Put the following method in your helper file (may be in application_helper.rb).

Continue reading →

Vuvuzela – The Symbol of Noise!

Vuvuzela - The symbol of Noise!

During the first match of 2010 Fifa World Cup between South Africa and Mexico, I heard some strange sound around me. The sound seemed like sound from a huge collection of bees. So I started looking around if is there any such bee swarm around our house. But, after changing the channel, the sound gone, it was from the television. I started checking all other channels and found no channel has any disturbance. So, no problem with our cable connection. Later, I told this to my elder brother to talk to cable operators as I believed it is their fault. However, on next day, after coming to my eldest brother’s house, I experienced same during football match. So, now I became sure, it is from the telecasting end! Still, I was wondering whats should it could be! The sound of crowed would never be like this. As I did not find any way to stop it, I dropped watching many matches  as the sound is really horrible.

Continue reading →