Setting up Ruby development setup with rbenv

I wanted to setup ruby source code on my machine. The source on Github has detailed instructions on how to do the setup.

Weirdness of

Recently i was bitten by this weirdness of BigDecimal in Ruby.

Setting up ispell and Emacs on Mac OS X

I was trying to setup flyspell mode on new Mac and whenever i do

Devise : Passing params to after_* paths

Devise allows us to customize after_signup_path by overriding a protected method in RegistrationsController.

VERP on Rails

We sent newsletter campaigns from our Rails app. One of the main requirement of such campaign is how many emails bounced?. We need to track all bounced emails and map them again to a specific campaign because there will be multiple campaigns going on all the time.

jQuery append and clone

I was trying to append some part of the DOM to some other element of the page.

enable minitest again

If you have skipped minitest/test-unit while creating a rails app with -T or want to move to minitest from rspec or want to start with minitest in an existing rails project without tests, its very easy.

preload associations with `find_by_sql`

I have a very complex query which is made up of more than 1 subqueries. Arel is awesome, but it can’t generate that query. So i generate those subqueries separately and combine them by union or intersection based on some condition. Finally the generated query is given to find_by_sql to get the data.

facebook app with multiple subdomains

I had a requirement of adding facebook integration with our Rails app. I am using omniauth-facebook gem for the authentication part and it works great.

conditional where in rails