Create dir with namespace. Create namespace with user

This commit is contained in:
Dmitriy Zaporozhets 2012-11-23 09:11:09 +03:00
parent f17ddeb394
commit ab9d023651
6 changed files with 39 additions and 26 deletions

View file

@ -1,5 +1,7 @@
class UserObserver < ActiveRecord::Observer
def after_create(user)
user.create_namespace(code: user.username, name: user.name)
log_info("User \"#{user.name}\" (#{user.email}) was created")
Notify.new_user_email(user.id, user.password).deliver
@ -10,7 +12,7 @@ class UserObserver < ActiveRecord::Observer
end
def after_save user
if user.username_changed?
if user.username_changed? and user.namespace
user.namespace.update_attributes(code: user.username)
end
end