Update the code to work with Rails 4.