Forum: Ruby on Rails Session not working in testing mode

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
91308e9bc88cb069fd1bcf88e910d042?d=identicon&s=25 Nick Snels (nicksnels)
on 2006-03-25 19:38

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 topic is locked and can not be replied to.