After upgrading an old Rails app from 3.2.x to 4.0.x I started getting a really weird error. Made all the more confusing by the fact that I couldn’t work out why it was trying to load Moped (given Mongoid 5.0.0 no longer uses Moped).
In fact it is trying to load something stored in a cookie. So clearing your cookies will solve this problem.

You can fix this problem by running rake secret and pasting the result over the current secret token in config/initializers/secret_token.rb – keeping in mind this will log everyone out and prevent the app from accessing anything stored in signed cookies.