Class: Kaui::AccountEmailsController
Instance Method Summary
collapse
#current_ability, #current_user, #options_for_klient
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 12
def create
@account_email = Kaui::AccountEmail.new(params[:account_email])
account = Kaui::Account.new(:account_id => @account_email.account_id)
begin
account.add_email(@account_email.email, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
redirect_to account_email_path(account.account_id), :notice => 'Account email was successfully added'
rescue => e
flash.now[:error] = "Error while adding the email: #{as_string(e)}"
render :action => :new
end
end
|
#destroy ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 25
def destroy
account = Kaui::Account.new(:account_id => params[:id])
begin
account.remove_email(params[:email], current_user.kb_username, params[:reason], params[:comment], options_for_klient)
redirect_to account_email_path(account.account_id), :notice => 'Account email was successfully deleted'
rescue => e
flash.now[:error] = "Error while deleting account email: #{as_string(e)}"
render :action => :show, :id => account.account_id
end
end
|
#new ⇒ Object
8
9
10
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 8
def new
@account_email = Kaui::AccountEmail.new(:account_id => params[:account_id])
end
|