Newbie question; best way to store simple session data?

As a first test project, I'm writing a little Rails app that simply lets one browse the directory structure on the server. (Obviously, this isn't intended for public deployment :slight_smile: ). One thing that needs to be stored in a session is the currently browsed directory. What's the best way to store such simple data? (I sorta think a database table is overkill :slight_smile: )

Thanks, Ken

ken wrote:

As a first test project, I'm writing a little Rails app that simply lets one browse the directory structure on the server. (Obviously, this isn't intended for public deployment :slight_smile: ). One thing that needs to be stored in a session is the currently browsed directory. What's the best way to store such simple data? (I sorta think a database table is overkill :slight_smile: )

Store it in a cookie.

Rails has a session management mechanism already built for you. Just use that. Store your value in the session hash then you can just configure Rails to store sessions either in a file (the default) or in the database if you prefer that.

Excerpt from Agile Web Development with Rails page 105: