From 15664d01ab69da8e7478dfd45cf52ef709349428 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 25 Apr 2013 14:00:41 +0200 Subject: defailt voicemail settings --- app/controllers/voicemail_accounts_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/voicemail_accounts_controller.rb b/app/controllers/voicemail_accounts_controller.rb index 7e00131..0bfa160 100644 --- a/app/controllers/voicemail_accounts_controller.rb +++ b/app/controllers/voicemail_accounts_controller.rb @@ -31,6 +31,15 @@ class VoicemailAccountsController < ApplicationController def create @voicemail_account = @parent.voicemail_accounts.new(params[:voicemail_account]) if @voicemail_account.save + if @parent.class == User + @email = @parent.email + end + @voicemail_account.voicemail_settings.create(:name => 'pin', :value => ("%06d" % SecureRandom.random_number(999999)), :class_type => 'String') + @voicemail_account.voicemail_settings.create(:name => 'notify', :value => 'true', :class_type => 'Boolean') + @voicemail_account.voicemail_settings.create(:name => 'attachment', :value => 'true', :class_type => 'Boolean') + @voicemail_account.voicemail_settings.create(:name => 'mark_read', :value => 'true', :class_type => 'Boolean') + @voicemail_account.voicemail_settings.create(:name => 'purge', :value => 'false', :class_type => 'Boolean') + @voicemail_account.voicemail_settings.create(:name => 'email', :value => @email, :class_type => 'String') m = method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" ) redirect_to m.( @parent ), :notice => t('voicemail_accounts.controller.successfuly_created') else @@ -65,4 +74,5 @@ class VoicemailAccountsController < ApplicationController authorize! :read, @parent end + end -- cgit v1.2.3