crear las raspberries si no existen
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
67c504f3e0
commit
97b455d413
1 changed files with 2 additions and 2 deletions
|
@ -49,8 +49,8 @@ class ReadingsController < ActionController::API
|
||||||
# número de serie apenas empiecen a actualizarse los nodemecu.
|
# número de serie apenas empiecen a actualizarse los nodemecu.
|
||||||
def raspberry
|
def raspberry
|
||||||
@raspberry ||= begin
|
@raspberry ||= begin
|
||||||
r = Raspberry.find_by(serial_number: params[:serial_number])
|
r = Raspberry.find_or_create_by(serial_number: params[:serial_number])
|
||||||
r ||= Raspberry.find_by(name: params[:controller_id])
|
r ||= Raspberry.find_or_create_by(name: params[:controller_id])
|
||||||
r.tap do |r|
|
r.tap do |r|
|
||||||
r.name = params[:controller_id]
|
r.name = params[:controller_id]
|
||||||
r.serial_number = params[:serial_number]
|
r.serial_number = params[:serial_number]
|
||||||
|
|
Loading…
Reference in a new issue