aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a8772ef7b..ffdf632f8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -39,12 +39,18 @@ class User < ActiveRecord::Base
self.username = value
end
end
- self.organisation = self.cas_assign_or_create_organisation extra_attributes[:organisation_name]
+ self.organisation = self.cas_assign_or_create_organisation(
+ {
+ code: extra_attributes[:organisation_code],
+ name: extra_attributes[:organisation_name]
+ }
+ )
end
- def cas_assign_or_create_organisation name
- Organisation.find_or_create_by(name: name) do |organisation|
+ def cas_assign_or_create_organisation code:, name:
+ Organisation.find_or_create_by(code: code) do |organisation|
organisation.name = name
+ organisation.code = code
end
end