Skip to content

Instantly share code, notes, and snippets.

@unnitallman
Created September 23, 2011 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unnitallman/1237177 to your computer and use it in GitHub Desktop.
Save unnitallman/1237177 to your computer and use it in GitHub Desktop.
Typecasting a base class object to a derived class object
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