type
es un campo reservado
This commit is contained in:
parent
eb01449dff
commit
4e0a1d2329
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
7
db/migrate/20220303170706_change_type.rb
Normal file
7
db/migrate/20220303170706_change_type.rb
Normal 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
|
Loading…
Reference in a new issue