Created
October 5, 2008 21:16
-
-
Save cachafla/14934 to your computer and use it in GitHub Desktop.
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
# La idea es que cada cuenta tiene un numero, por ej 5. Pero su padre tiene numero 2 y el padre de este tiene numero 1. | |
# Entonces quiero generar el numero en forma: "1.2.5. Cuenta XXX" | |
# Lo que hago es ir subiendo en la recursion hasta llegar a la raiz que es parent.nil? | |
def numero_total | |
if parent.nil? | |
return"#{numero}." | |
else | |
return "" + parent.numero_total | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment