Assume that I have a global variable user in application....like this:
# GET /users.xml
def index
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
Is that mean every request, a new @user is created? If every request , an object is created, when will it destroyed? Also, if vistorA go to the web site, a @userA is created, and vistorB go to the web site @userB is created. Will the vistorA have a chance to get the vistorB 's object (@userB)? Also, when will the object release? Thank you.
**Update: the @users is not the global variable, it is a instance variable. So, a question to follow up. How does the server know which @user is belong to which request? Thank you.