Skip to content
Snippets Groups Projects
Commit 435a72c7 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'fix-default-role' into 'master'

Set default role as teacher



See merge request !132
parents 62c2663b 55f880f6
No related branches found
No related tags found
No related merge requests found
......@@ -27,8 +27,9 @@ class User < ActiveRecord::Base
has_and_belongs_to_many :roles
after_create SyncUserRepositoryService.new
after_destroy SyncUserRepositoryService.new
after_create :default_role
after_destroy SyncUserRepositoryService.new
after_destroy CreateUserBookmarksService.new
has_attached_file :avatar, styles: {medium: "300x300>", thumb: "60x60>"}, default_url: lambda { |image| ActionController::Base.helpers.asset_path('user-anon.png') }
......@@ -56,8 +57,13 @@ class User < ActiveRecord::Base
roles.each do |role|
return true if role.name == "admin"
end
false
end
private
def default_role
roles << role_repository.find_by_name("teacher")
end
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