Topic: making one variable equal to another
Given Ruby's odd (to me anyway) way of using variables to point to values instead of holding them, what is the best way to load one variable with the value in another so that the new variable does not change in synch with the other? Rails loves to discard things that I want to keep - and the only method i have come across is:
@order.ship_to = @customer.addr.dup
where (hopefully) @order.ship_to does not reset to nil when the customer instance variables are trashed by Rails...
I guess Ruby was designed this way for a reason - but I cannot see why you would want one variable to have several names. Why not use the same variable name throughout? Under what circumstances is this useful?