validaciones

This commit is contained in:
f 2022-03-03 14:47:26 -03:00
parent 14eeab50e2
commit 535191d26d
3 changed files with 7 additions and 0 deletions

View file

@ -4,4 +4,6 @@ class Arduino < ApplicationRecord
belongs_to :raspberry
belongs_to :reading
has_many :sensors
validates_presence_of :local_id
end

View file

@ -3,4 +3,7 @@
class Raspberry < ApplicationRecord
has_many :readings
has_many :arduinos
validates_presence_of :name
validates_uniqueness_of :name
end

View file

@ -2,4 +2,6 @@
class Sensor < ApplicationRecord
belongs_to :arduino
validates_presence_of :timestamp, :local_type, :value, :unit
end