Ruby on Rails
PageNotFoundErrorOnAllPages

Common Symptoms

#<ActionController::SessionRestoreError: 
Session contained objects where the class definition wasn't available. 
Remember to require classes for all objects kept in the session. 
(Original exception: uninitialized constant User [NameError])>  

Problem

This can happen when you are running multiple Rails applications on the same server and some of them have the same Model names. Consequently, when marshalling the session objects, the Rails application runs into an unexpected object structure.

Solution

Add the following code to the end of your config/environment.rb file, replacing “pre.” with some unique prefix:

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:prefix => 'pre.')