I wanted session to store the key to the stimulis table row
being viewed in the Subjects table.
Ok…
session[:runexp] ||= Subject.new
where subjects is a table, subject.rb a model…
that line causes an error
What’s the error? It looks OK to me.
It turns out
session[:runexp] ||= Subject.id
I very much doubt that’s doing what you think it is, or what you want.
It’s not doing anything to do with the database, for a start.
does not give an error, so for now, I will just store single
values in session.
But what do I need to do so this session is stored
in a database? Right now, I think it is stored in memory.
Uncomment this line in config/environment.rb:
and run rake create_sessions_table in the root directory of your app.
Now for the next question: why do you want to store the session in the
database? I think you might be trying to do something else, and might
have the terminology mixed up. Apologies if that’s not the case, but
worrying about where the session is stored is usually something that
gets dealt with later in the development cycle.