Question 1:
What is the scope of an instance variables in Rails actions (methods). Does each connection to the server form a new instance of a controller?
For example:
- User_A loads a 'setter' page, causing a random instance variable called
@randIntto be generated. - User_B (from another PC elsewhere) loads a 'getter' page, requesting
@randInt.
Will User_B retrieve the @randInt set by User_A? Or is that instance variable unique to User_A's connection?
Question 2:
Question 2 is the same as question 1, but using @@randInt instead. If the answer to Question 2 is, "yes, both users can see this value," is it an acceptable practice to use global variables in Rails to store temporary data that you want to share among multiple users?