Dont update namespace if User name was changed. Use user#username for namespace name because Namespace#name validates by uniq

This commit is contained in:
Dmitriy Zaporozhets 2013-08-29 21:44:45 +03:00
parent 3d41e182c2
commit 07f156f5c2

View file

@ -13,8 +13,8 @@ class UserObserver < BaseObserver
# Ensure user has namespace
user.create_namespace!(path: user.username, name: user.username) unless user.namespace
if user.username_changed? || user.name_changed?
user.namespace.update_attributes(path: user.username, name: user.name)
if user.username_changed?
user.namespace.update_attributes(path: user.username, name: user.username)
end
end
end