In PHP, you can make two variables point to the same data.
$a = 'foo'; $b = 'bar'; $a =& $b; echo $a // Outputs: bar echo $b // Outputs: bar
What we are trying to do in Ruby is set @app_session to be equal to session[@current_app[:uid]]. So we only have to deal with @app_session in our app, and everything is automatically saved to the session.
Is there a way to do this in Ruby? After 15 minutes of reading, googling, and asking around here at the office, we’re still lost… lol
All variables in Ruby are references to an object.
means that a and b point to the same object. That’s why when you want to copy a given object, you need to write
Writing
points to the same object so you should be fine.
EDIT: you can verify this this way: