Replaced deprecated function to its Rails counterpart