DEV Community

Jeeho Lee
Jeeho Lee

Posted on

Ruby variables and pointers

Today I learned that in Ruby, almost every variable is a reference/pointer to an object. It makes sense, since when working with databases in Rails, calling .destroy actually affected the object in the database instead of destroying a copy. I think it'll be good to note going forward on whether a method returns a copy or actually alters the object being referenced.

Top comments (0)