may have fixed some pg sql issues
Added cancan redirect