Fix compatibility with Rails 4