Every time you make a request, ie call a controller action, your rails 
application effectively starts from scratch.  There's no persistent 
instance data between requests, and the reason for this is obvious: 
imagine that you and another person are using the website at the same 
time.  If objects persisted between requests, how would the server know 
which one was yours and which was the other persons?

That's why almost every action uses params[:id] to load an object from 
the db, or uses params from a form to build a new object.

One seeming exception to this is the session, but even this doesn't 
persist - it uses cookies to get a session key which is used to reload 
the session data from the sessions table in the database.
-- 
Posted via http://www.ruby-forum.com/.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to