Added rake
Enclosed else part in begin rescue block, try supported in rails only
Fixed test cases