Created
September 23, 2011 11:47
-
-
Save unnitallman/1237177 to your computer and use it in GitHub Desktop.
Typecasting a base class object to a derived class object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u = User.find(id) | |
u = u.becomes(u.type.constantize) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment