Last active
August 29, 2015 14:01
-
-
Save gil27/4b3cee7057daf435676f to your computer and use it in GitHub Desktop.
Dois métodos, mesmo Gil
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
module DiretoriosHelper | |
def diretorio_lista_empresas(usuario) | |
a= Array.new | |
if not usuario.cliente.filial? | |
empresas = usuario.cliente.filiais | |
a << usuario.cliente | |
empresas.each do |empresa| | |
a << empresa | |
end | |
a | |
else | |
a << usuario.cliente | |
end | |
end | |
def diretorio_lista_empresas(cliente) | |
([cliente] << cliente.filiais).flatten | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thumbs up! o/