Fix Rails4 deprecated problems