Module: Sivel2Gen::UbicacionHelper

Defined in:
app/helpers/sivel2_gen/ubicacion_helper.rb

Instance Method Summary collapse

Instance Method Details

#formato_ubicacion(u, con_centropoblado = true) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/sivel2_gen/ubicacion_helper.rb', line 4

def formato_ubicacion u, con_centropoblado = true
  r = "";
  if u
    r = Msip::Pais.find(u.pais_id).nombre
    if u.departamento_id
      r += " / " + Msip::Departamento.where(
		id: u.departamento_id).take.nombre
      if u.municipio_id
        r += " / " + Msip::Municipio.where(
			id: u.municipio_id).take.nombre
        if u.centropoblado_id && con_centropoblado
          r += " / " + Msip::Centropoblado.where(
				id: u.centropoblado_id).take.nombre
        end
      end
    end
  end
  return r
end