What is the lifetime of ActionController, etc?

I realize that I don’t know what causes an ActionController to be
created and destroyed. As a specific example, consider:

class UsersController < ApplicationController

def myState
  @myState ||= Object.new
end

def show
  ...
end

end

Is there one ActionController created per user session? Will myState
persist across GET and POST calls? Is the lifetime different in
developer mode versus production mode?

To generalize the question: Are there any good references on the
lifetime of various RoR objects in a running server?

On May 27, 6:55pm, Fearless F. [email protected] wrote:


end
end

Is there one ActionController created per user session? Will myState
persist across GET and POST calls? Is the lifetime different in
developer mode versus production mode?

No - one per request.

Fred

Frederick C. wrote in post #1001585:

No - one per request.
Fred

And some experimentation says that models don’t persist either.

Then the only things that persist across requests are the session hash
and the database itself (and anything that the server chooses to cache)
– correct?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs