[Rails] docs on session management

David Heinemeier Hansson david at loudthinking.com
Sun Mar 20 12:01:04 GMT 2005


> Another silly question: where can I find docs about session 
> management? I came from Apple's WebObjects which is a well documented 
> (and also well designed) web application framework and I really miss 
> sessions in Ruby On Rails. I need the points of session creation and 
> disposal.

Setting a session value:
   @session[:greeting] = "Hello world!"

Reading a session value:
   @session[:greeting] # => "Hello world!"

Deleting a single session value:
   @session.delete :greeting

Clearing an entire session:
   reset_session

See more under "Sessions" in 
http://rails.rubyonrails.com/classes/ActionController/Base.html

> And a plus question: I see the layout of a tipical rails app. But 
> where's the place of other custom business logic classes? How to place 
> them?

If they're entity/value object classes, they go into app/models. If 
they're libraries, they go into lib/. Both places are part of the load 
path.
--
David Heinemeier Hansson,
http://www.basecamphq.com/   -- Web-based Project Management
http://www.rubyonrails.org/  -- Web-application framework for Ruby
http://www.loudthinking.com/ -- Broadcasting Brain



More information about the Rails mailing list