Fix depracation errors on rails 4