Hi, I''ve been adding user authentication to a couple sites using the examples provided here: http://wiki.rubyonrails.com/rails/show/Authentication The first site that I added the authentication to worked relatively well, but occassionally the application would die when I was trying to login/logout, or do something that required authentication. I would have to delete the temporary session files in /tmp/ and restart apache. Now, I''m on the second site and I did exactly the same thing and I can''t even login without the application crashing. I don''t believe this is a fastcgi issue because it seems to do it regardless of whether I''m using fastcgi. When I am using fastcgi, it does give me the following error in fastcgi.crash.log: # Logfile created on Mon May 16 14:41:02 MDT 2005 by logger.rb/1.5.2.4 [Mon May 16 14:41:02 MDT 2005] Dispatcher failed to catch: Session contained objects where the class definition wasn''t available. Remember to require classes for all objects kept in the session. The session has been deleted. (Original exception: undefined class/module User [ArgumentError]) (ActionController::SessionRestoreError) /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/cgi_process.rb:90:in `session'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/base.rb:689:in `assign_shortcuts'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/base.rb:326:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/rescue.rb:20:in `process_with_exception'' /usr/local/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/dispatcher.rb:34:in `dispatch'' /usr/home/james/Sites/icionline-ruby/public/dispatch.fcgi:20 /usr/home/james/Sites/icionline-ruby/public/dispatch.fcgi:18:in `each_cgi'' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each'' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'' /usr/home/james/Sites/icionline-ruby/public/dispatch.fcgi:18 Does anyone know what''s going on with this?
On 5/16/05, James Earl <james-DkjEhSRHeDJAFePFGvp55w@public.gmane.org> wrote:> # Logfile created on Mon May 16 14:41:02 MDT 2005 by logger.rb/1.5.2.4 > [Mon May 16 14:41:02 MDT 2005] Dispatcher failed to catch: Session > contained objects where the class definition wasn''t available. Remember > to require classes for all objects kept in the session. The session has > been deleted. (Original exception: undefined class/module User > [ArgumentError]) (ActionController::SessionRestoreError)You;re getting this error because you are storing a User object in the session, and at the time the session information is re-instantiated, the application does not yet have a definition for the User class. Modifying ApplicationController as follows should solve the problem: class ApplicationController < ActionController::Base model :user ... end -- Regards, John Wilger ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don''t know," Alice answered. "Then," said the cat, "it doesn''t matter." - Lewis Carrol, Alice in Wonderland
On Mon, 2005-05-16 at 18:18 -0400, John Wilger wrote:> On 5/16/05, James Earl <james-DkjEhSRHeDJAFePFGvp55w@public.gmane.org> wrote: > > # Logfile created on Mon May 16 14:41:02 MDT 2005 by logger.rb/1.5.2.4 > > [Mon May 16 14:41:02 MDT 2005] Dispatcher failed to catch: Session > > contained objects where the class definition wasn''t available. Remember > > to require classes for all objects kept in the session. The session has > > been deleted. (Original exception: undefined class/module User > > [ArgumentError]) (ActionController::SessionRestoreError) > > You;re getting this error because you are storing a User object in the > session, and at the time the session information is re-instantiated, > the application does not yet have a definition for the User class. > Modifying ApplicationController as follows should solve the problem: > > class ApplicationController < ActionController::Base > model :user > ... > end >Hi John, This worked, thank you!