-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alterações para remoção do usuário da escolamodelows
- Loading branch information
1 parent
20c1a38
commit f44f7c2
Showing
9 changed files
with
101 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ruby-2.5.1 | ||
ruby-2.5.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,9 @@ | ||
class User < ApplicationRecord | ||
authenticates_with_sorcery! | ||
# authenticates_with_sorcery! | ||
attr_accessor :skip_password, :uid, :redirect_page | ||
validates :password, length: { minimum: 8 }, unless: :skip_password | ||
validates :password, confirmation: true | ||
validates :email, uniqueness: true | ||
validates :cpf, length: { is: 14 }, uniqueness: true | ||
before_save :capitalize_name | ||
belongs_to :role | ||
has_many :certificates | ||
has_many :contact_us_conversations | ||
has_many :course_registrations | ||
has_one_attached :avatar | ||
def capitalize_name | ||
self.first_name=self.first_name.split.map(&:capitalize).join(' ') | ||
if self.last_name.present? | ||
self.last_name=self.last_name.split.map(&:capitalize).join(' ') | ||
else | ||
self.last_name = self.first_name.split[1..-1].join(' ') | ||
self.first_name = self.first_name.split[0] | ||
end | ||
if !self.role_id.present? | ||
self.role_id = 2 | ||
end | ||
end | ||
has_many :access_grants, class_name: "Doorkeeper::AccessGrant", | ||
foreign_key: :resource_owner_id, | ||
dependent: :delete_all # or :destroy if you need callbacks | ||
|
||
has_many :access_tokens, class_name: "Doorkeeper::AccessToken", | ||
foreign_key: :resource_owner_id, | ||
dependent: :delete_all # or :destroy if you need callbacks | ||
has_many :authentications, :dependent => :destroy | ||
accepts_nested_attributes_for :authentications | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
json.quiz do | ||
json.array! @quiz_questions do |question| | ||
json.id question.id | ||
json.question question.question | ||
json.answers do | ||
json.array! question.quiz_answers, :id, :answer | ||
end | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class RemoveEmailFromUsers < ActiveRecord::Migration[5.2] | ||
def change | ||
remove_column :users, :email, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.