Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
Rails API returns numeric as string

In my Rails 6 app I have a sales database with a value column. Since this is a 2 decimal number I changed the type to

change_column :sales, :value, :decimal, precision: 10, scale: 2

This app has an API where I render a sales object to json. When I read this API with my angular object and do:

console.log(typeof this.sale.id)

I get string. And when I log the value I get:

value: "40.0"

Why does this happen? Before, when the columns was simples numeric this did not happen. I know that I can convert the variable in JS to a float but I would like to know the reason and avoid converting the variable type.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda