Building Strings in Ruby

If efficiency is important to you, don’t build a new string when you can append items onto an existing string. Constructs like str << ‘a’ + ‘b’ orĀ  str << “#{var1} #{var2}” create new strings that are immediately subsumed into the larger string. This is exactly the thing to avoid. Use str << var1 << [...]

Starting on the formal journey into Ruby!

I’ll be starting with Ruby Cookbook today (it’s evening right now..). I will be discussing Ruby code, Constructs, Positives and Negatives as I encounter them. So expect lot of Ruby (and may be rails) here.
Association with the language: Why I fell in Love with Ruby

Rails: getting multiple selected values from selection box

I got stuck for last half an hour at ‘getting the values of multiple selected items in a muliple selection box’ using Ruby/Rails. Got it after hard ‘googling’ and got the solution here.
When trying to get multiple selected values from a <SELECT> tag into @params, call your parameter something with [] on the end. [...]

sending mails using ruby

There is a very common requirement especially in web services, that of sending notification email for some action say, addition/deletion/updation of database in user signup or product selection in a shopping cart. Ruby handles it beautifully. This is obvious. What is not obvious is that it actually gives user different ways of implementing it.

RubyMail
TMail
ActionMailer (uses [...]