diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-27 10:31:08 +0100 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-27 10:31:08 +0100 |
commit | a634e8b158dac11250181d7cae35a08afbea96d4 (patch) | |
tree | 4695f1dc418ae9016ac56ccf7a6f2d6959d9a0e2 /app | |
parent | d5ac8f72af16fa5487ab1e16bf784e8125a7b450 (diff) |
create voicemail account for newly crested users
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/users_controller.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 584d08c..ea8ed69 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,6 +22,12 @@ class UsersController < ApplicationController def create @user = @parent.users.build(params[:user]) if @user.save + if VoicemailAccount.where(:name => "user_#{@user.user_name}").count == 0 + @user.voicemail_accounts.create(:name => "user_#{@user.user_name}", :active => true ) + else + @user.voicemail_accounts.create(:active => true) + end + if @parent.class == Tenant @parent.tenant_memberships.create(:user => @user) if @parent.user_groups.exists?(:name => 'Users') |