no multiplicar los arduinos
This commit is contained in:
parent
3a1b78f238
commit
e085d5345d
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ class ReadingsController < ActionController::API
|
||||||
params[:arduinos]&.reject do |a|
|
params[:arduinos]&.reject do |a|
|
||||||
a[:id].blank? || a[:sensores].empty?
|
a[:id].blank? || a[:sensores].empty?
|
||||||
end&.each do |a|
|
end&.each do |a|
|
||||||
arduino = reading.arduinos.build local_id: a[:id], raspberry: raspberry
|
arduino = reading.arduinos.find_or_initialize_by(local_id: a[:id], raspberry: raspberry)
|
||||||
|
|
||||||
a[:sensores].each do |s|
|
a[:sensores].each do |s|
|
||||||
arduino.sensors.build(sensor_params s)
|
arduino.sensors.build(sensor_params s)
|
||||||
|
|
Loading…
Reference in a new issue