Skip to content
Snippets Groups Projects
Commit 4d4ea606 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

check teacher_id and birthday before save

parent ebc8881e
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,7 @@ class User < ApplicationRecord
has_many :applications
after_create :default_role
before_save :verify_teacher_id
after_save :verify_dspace_info
has_attached_file :avatar, styles: { medium: '300x300>', thumb: '60x60>' }, default_url: ''
......@@ -288,6 +289,14 @@ class User < ApplicationRecord
end
end
def verify_teacher_id
return true if (changed & ["teacher_id", "birthday"]).empty?
#TODO: call simcaq api
errors.add(:teacher_id, "Incorreto")
errors.add(:birthday, "Incorreto")
return false
end
def activity_owner
self
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment