For Rails3 and Ruby1.9 later

This pull-request from scaleout fork repository.
Fixed rails3 and ruby 1.9 later.