Skip to content

Instantly share code, notes, and snippets.

@joseramonc
Last active August 29, 2015 14:07
Show Gist options
  • Save joseramonc/7488aba4efd35cd7587b to your computer and use it in GitHub Desktop.
Save joseramonc/7488aba4efd35cd7587b to your computer and use it in GitHub Desktop.
def allCB
@corporativoCB = Corporativo.all
@clasesActividadCB = ClaseActividad.all
@clasificadorCB = ClasificadorSe.all
@clasificador_id = -1;
@clases_actividad_id =-1;
@countryCB = Country.all
@stateCB = Array.new# = State.all
@municipioCB=Array.new# = Municipio.all
@pobladoCB=Array.new #= Poblado.all
if !@negocio.datos_facturacion_negocio.direccion.nil?
@country_id = @negocio.datos_facturacion_negocio.direccion.country_id
@state_id = @negocio.datos_facturacion_negocio.direccion.state_id
@municipio_id = @negocio.datos_facturacion_negocio.direccion.municipio_id
@poblado_id = @negocio.datos_facturacion_negocio.direccion.poblado_id
end
if @country_id.nil?
@country_id = 139
end
@stateCB = Country.find(@country_id).states
if @state_id.nil? && @stateCB.count>0
@state_id = @stateCB.first.id
end
if @stateCB.count > 0
@municipioCB = @stateCB.find(@state_id).municipios
end
if !@state_id.nil? && @municipio_id.nil? && @municipioCB.count>0
@municipio_id = @municipioCB.first.id
end
if @municipioCB.count> 0
@pobladoCB = @municipioCB.find(@municipio_id).poblados
end
end
@robbyrussell
Copy link

Oh, yes... the allCB paradox. It's my (un)professional opinion that the original developer wrote this within a few days of personal turmoil from a family-related dispute. Given that they felt the need to define new arrays, they were struggling to figure out how they would reunite with friends that they hadn't spoken to in quite some time. The developer was confident that at least one of the would return a call, but would the others show up for the party?

@arandilopez
Copy link

The CB I think is because ComboBox... Trust me, I got the same here but in Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment