Problem: Incompatible character encodings error while importing csv files in ruby 1.9 which have data in multiple languages.

I am using rails 3 and ruby 1.9.2 in my application. While importing/parsing the CSV, I get an error “Incompatible character encodings: ASCII-8bit and UTF-8”. I quickly checked my database encoding, it was UTF-8 only and also in application.rb, I had Read on →

If you wanna display the list of records with different(alternate) classes for table rows, then you can use this helper(you no need to check odd-even records). Rails has so many awesome feature like this.

for ex: if you want to apply ‘odd’ and ‘even’ class for alternate record Read on →

How to display a date with suffix like “th”, “st”, “nd”, or “rd”?

for example, I wanna display like this Mon, 7th April

Rails has inbuilt function – “ordinalize” Read on →