type es un campo reservado

This commit is contained in:
f 2022-03-03 14:12:39 -03:00
parent eb01449dff
commit 4e0a1d2329
2 changed files with 10 additions and 1 deletions

View file

@ -49,7 +49,9 @@ class ReadingsController < ActionController::API
# Procesa los parámetros de un sensor # Procesa los parámetros de un sensor
def sensor_params(sensor) def sensor_params(sensor)
sensor.permit(:timestamp, :type, :value, :unit, :error) sensor.permit(:timestamp, :type, :value, :unit, :error).tap do |p|
p[:local_type] = p.delete :type
end
end end
end end

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class ChangeType < ActiveRecord::Migration[6.1]
def change
rename_column :sensors, :type, :local_type
end
end