I have a sqlite3 database with the sessions table and schema set up
correctly. Sessions are created fine and put in the table, the cookie
is set with the correct hash and the hash is found again but when
using @state the values aren’t updated in the table.
I know that Session::service is called and the contents of the record
are put into session like so:
#<Camping::Models::Session id: 1, hashid:
“iSCMSIzV7ITsRTr0UMA8Gko3LEnY3bw4”, created_at: “2008-07-24 17:11:43”,
ivars: {}>
I do @state.user = 5, then it then gets as far as making session look
like this:
#<Camping::Models::Session id: 1, hashid:
“iSCMSIzV7ITsRTr0UMA8Gko3LEnY3bw4”, created_at: “2008-07-24 17:11:43”,
ivars: {“TLCMS”=>{“user”=>5}}>
But then session.save doesn’t write to the table, and doesn’t throw an
error (session.save! doesn’t either). Can anyone see what is going
wrong?
As far as I remember the saving is automatic, why_ always makes it
easier not harder
you shouldn’t need to call save. Have you checked the database from
sqlite’s utility?
is set with the correct hash and the hash is found again but when
#<Camping::Models::Session id: 1, hashid:
“iSCMSIzV7ITsRTr0UMA8Gko3LEnY3bw4”, created_at: “2008-07-24 17:11:43”,
ivars: {“TLCMS”=>{“user”=>5}}>
But then session.save doesn’t write to the table, and doesn’t throw an
error (session.save! doesn’t either). Can anyone see what is going
wrong?
I’m not calling save, I just added prints in the camping source for
debugging and I found that it does in fact call save, but isn’t saved.
Looking through sqlite3(1) the sessions are created, but their
contents is not saved.
Thanks for finding the problem as I am using Camping quite a bit at the
minute - do you know how to use your own database instead of camping.db?
I tried putting another db name in the postamble as I have seen in
examples but it still just uses camping.db.