validaciones
This commit is contained in:
parent
14eeab50e2
commit
535191d26d
3 changed files with 7 additions and 0 deletions
|
@ -4,4 +4,6 @@ class Arduino < ApplicationRecord
|
|||
belongs_to :raspberry
|
||||
belongs_to :reading
|
||||
has_many :sensors
|
||||
|
||||
validates_presence_of :local_id
|
||||
end
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
class Raspberry < ApplicationRecord
|
||||
has_many :readings
|
||||
has_many :arduinos
|
||||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
end
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
class Sensor < ApplicationRecord
|
||||
belongs_to :arduino
|
||||
|
||||
validates_presence_of :timestamp, :local_type, :value, :unit
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue