From bd578d96b47c9fadd91fa95a7913bf65f3623128 Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Fri, 18 Aug 2017 10:31:59 -0700 Subject: Add namespace errors from User#after_update --- app/models/user.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/models/user.rb') diff --git a/app/models/user.rb b/app/models/user.rb index 579ab898784..fbd08bc4d0a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -837,7 +837,12 @@ class User < ActiveRecord::Base create_namespace!(path: username, name: username) unless namespace if username_changed? - namespace.update_attributes!(path: username, name: username) + unless namespace.update_attributes(path: username, name: username) + namespace.errors.each do |attribute, message| + self.errors.add(:"namespace_#{attribute}", message) + end + raise ActiveRecord::RecordInvalid.new(namespace) + end end end -- cgit v1.2.1