Session not working in testing mode


I’m having a problem with my sessions. I recently switched from storing
sessions on disk to storing them in MySQL. I ran rake
create_sessions_table to create the sessions table. But instead of just
using the standard table, I wanted something fancier. I would like to
know who is currently logged in, so I added the field user_id to the
sessions table. In the Rails wiki
( I read
that I could change the user_id in the sessions table by using
@session.model.user_id = @session[:user].id . model is a method
available when using active_record_store. This all works beautifully, at
least in development mode. However, the trouble starts when I run a
functional test. Everything blows up. The error I get is:

NoMethodError (undefined method `model’ for

So it appears to me that the method model is defined in development but
not in testing mode. But I cann’t find a solution for this problem. Any
help is appreciated.

Kind regards,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs