Skip to content
This repository
Browse code

Added documentation on models in sessions #929 [c.r.mcgrath@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1000 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit cef57e0cc244062663ad5fc5652072a12f06aaf2 1 parent a5b55c6
David Heinemeier Hansson authored March 26, 2005

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  actionpack/lib/action_controller/base.rb
7  actionpack/lib/action_controller/base.rb
@@ -105,6 +105,13 @@ class MissingFile < ActionControllerError #:nodoc:
105 105
   # Any object can be placed in the session (as long as it can be Marshalled). But remember that 1000 active sessions each storing a
106 106
   # 50kb object could lead to a 50MB memory overhead. In other words, think carefully about size and caching before resorting to the use
107 107
   # of the session.
  108
+  # 
  109
+  # If you store a model in the session, you must also include a line like:
  110
+  #
  111
+  #   model :person
  112
+  #
  113
+  # For that particular controller. In Rails, you can also just add it in your app/controller/application.rb file (so the model is available
  114
+  # for all controllers). This lets Action Pack know to have the model definition loaded before retrieving the object from the session.
108 115
   #
109 116
   # For removing objects from the session, you can either assign a single key to nil, like <tt>@session[:person] = nil</tt>, or you can
110 117
   # remove the entire session with reset_session.

0 notes on commit cef57e0

Please sign in to comment.
Something went wrong with that request. Please try again.