Skip to content

Instantly share code, notes, and snippets.

@marialecodes
Created April 7, 2015 18:36
Show Gist options
  • Save marialecodes/b3bd838e911d11c0b986 to your computer and use it in GitHub Desktop.
Save marialecodes/b3bd838e911d11c0b986 to your computer and use it in GitHub Desktop.
n_conceptos_nivel = conceptos_nivel.count
conceptos_conocidos_nivel = conocimientos
.joins(:concepto)
.where(concepto: conceptos_nivel)
.order('
CASE
WHEN conocido = TRUE then 1
WHEN conocido = FALSE then 2
WHEN conocido IS NULL then 3
END
')
.pluck(
'conceptos.id',
'conceptos.nombre',
'conocimientos.conocido',
'conocimientos.revision',
'conocimientos.procesando'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment