Ruby script/generate scaffold Product Admin hangs

I wanted session to store the key to the stimulis table row
being viewed in the Subjects table.

Trying to mimick the cart example in the book, I started
with the line

session[:runexp] ||= Subject.new

where subjects is a table, subject.rb a model…
that line causes an error

It turns out
session[:runexp] ||= Subject.id

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.

thank you for your help.

anne

Anne G wrote:

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:

config.action_controller.session_store = :active_record_store

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.

Feel free to email me off-list if you want.

I saw this information

To use ActiveRecord as a session storage mechanism, you will
need a table in your database named sessions:

CREATE TABLE sessions (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
sessid CHAR(32),
data TEXT,
PRIMARY KEY(id),
INDEX(sessid)
);
http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore

but I don’t know what I am supposed to do with it? how do I
use it with the session method?

anne