yutear el código
This commit is contained in:
parent
c5cfa79acb
commit
a989cee018
10 changed files with 38 additions and 1 deletions
1
Gemfile
1
Gemfile
|
@ -37,6 +37,7 @@ group :development do
|
||||||
gem 'listen', '~> 3.3'
|
gem 'listen', '~> 3.3'
|
||||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
|
gem 'rubocop'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|
20
Gemfile.lock
20
Gemfile.lock
|
@ -62,6 +62,7 @@ GEM
|
||||||
zeitwerk (~> 2.3)
|
zeitwerk (~> 2.3)
|
||||||
addressable (2.8.0)
|
addressable (2.8.0)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
|
ast (2.4.2)
|
||||||
bindex (0.8.1-x86_64-linux-musl)
|
bindex (0.8.1-x86_64-linux-musl)
|
||||||
bootsnap (1.7.5-x86_64-linux-musl)
|
bootsnap (1.7.5-x86_64-linux-musl)
|
||||||
msgpack (~> 1.0)
|
msgpack (~> 1.0)
|
||||||
|
@ -102,6 +103,9 @@ GEM
|
||||||
nio4r (2.5.7-x86_64-linux-musl)
|
nio4r (2.5.7-x86_64-linux-musl)
|
||||||
nokogiri (1.11.7-x86_64-linux)
|
nokogiri (1.11.7-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
|
parallel (1.20.1)
|
||||||
|
parser (3.0.2.0)
|
||||||
|
ast (~> 2.4.1)
|
||||||
pg (1.2.3-x86_64-linux-musl)
|
pg (1.2.3-x86_64-linux-musl)
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
puma (5.3.2-x86_64-linux-musl)
|
puma (5.3.2-x86_64-linux-musl)
|
||||||
|
@ -140,11 +144,25 @@ GEM
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.13)
|
rake (>= 0.13)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
|
rainbow (3.0.0)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
rb-fsevent (0.11.0)
|
rb-fsevent (0.11.0)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
regexp_parser (2.1.1)
|
regexp_parser (2.1.1)
|
||||||
|
rexml (3.2.5)
|
||||||
|
rubocop (1.18.3)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.0.0.0)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml
|
||||||
|
rubocop-ast (>= 1.7.0, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.8.0)
|
||||||
|
parser (>= 3.0.1.1)
|
||||||
|
ruby-progressbar (1.11.0)
|
||||||
rubyzip (2.3.2)
|
rubyzip (2.3.2)
|
||||||
sass-rails (6.0.0)
|
sass-rails (6.0.0)
|
||||||
sassc-rails (~> 2.1, >= 2.1.1)
|
sassc-rails (~> 2.1, >= 2.1.1)
|
||||||
|
@ -175,6 +193,7 @@ GEM
|
||||||
turbolinks-source (5.2.0)
|
turbolinks-source (5.2.0)
|
||||||
tzinfo (2.0.4)
|
tzinfo (2.0.4)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (2.0.0)
|
||||||
web-console (4.1.0)
|
web-console (4.1.0)
|
||||||
actionview (>= 6.0.0)
|
actionview (>= 6.0.0)
|
||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
|
@ -209,6 +228,7 @@ DEPENDENCIES
|
||||||
puma (~> 5.0)
|
puma (~> 5.0)
|
||||||
rack-mini-profiler (~> 2.0)
|
rack-mini-profiler (~> 2.0)
|
||||||
rails (~> 6.1.4)
|
rails (~> 6.1.4)
|
||||||
|
rubocop
|
||||||
sass-rails (>= 6)
|
sass-rails (>= 6)
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
spring
|
spring
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MeasurementsController < ApplicationController
|
class MeasurementsController < ApplicationController
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
|
|
||||||
def create
|
def create
|
||||||
sensor = Sensor.find_or_create_by id: params[:sensor_id]
|
sensor = Sensor.find_or_create_by id: params[:sensor_id]
|
||||||
sensor.measurements.create params.permit(:temperature, :level, :flow, :turbidity, :conductivity, :ph)
|
sensor.measurements.create params.permit(:temperature, :level, :flow, :turbidity, :conductivity, :ph)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationJob < ActiveJob::Base
|
class ApplicationJob < ActiveJob::Base
|
||||||
# Automatically retry jobs that encountered a deadlock
|
# Automatically retry jobs that encountered a deadlock
|
||||||
# retry_on ActiveRecord::Deadlocked
|
# retry_on ActiveRecord::Deadlocked
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
default from: 'from@example.com'
|
default from: 'from@example.com'
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationRecord < ActiveRecord::Base
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
self.abstract_class = true
|
self.abstract_class = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Measurement < ApplicationRecord
|
class Measurement < ApplicationRecord
|
||||||
belongs_to :sensor
|
belongs_to :sensor
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Sensor < ApplicationRecord
|
class Sensor < ApplicationRecord
|
||||||
has_many :measurements
|
has_many :measurements
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue