diff options
author | Azul <azul@leap.se> | 2012-12-17 17:48:39 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-12-17 17:48:39 +0100 |
commit | b90ce01890907d1c7f46f46bafcef416570a4c4b (patch) | |
tree | f8f7ac9560b37bba6272b0251f0be4d65e691314 /users/app/controllers | |
parent | 7528695461f2c5725fe29787aa6bf703050a1a4a (diff) |
enabled destroying email aliases - no ajax yet.
Diffstat (limited to 'users/app/controllers')
-rw-r--r-- | users/app/controllers/email_aliases_controller.rb | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/users/app/controllers/email_aliases_controller.rb b/users/app/controllers/email_aliases_controller.rb index 751df85..3b0d5ac 100644 --- a/users/app/controllers/email_aliases_controller.rb +++ b/users/app/controllers/email_aliases_controller.rb @@ -4,29 +4,10 @@ class EmailAliasesController < ApplicationController respond_to :html - # get a list of email aliases for the given user? - def index - @aliases = @user.email_aliases - respond_with @aliases - end - - def create - @alias = @user.add_email_alias(params[:email_alias]) - flash[:notice] = t(:email_alias_created_successfully) unless @alias.errors - respond_with @alias, :location => edit_user_path(@user, :anchor => :email) - end - - def update - @alias = @user.get_email_alias(params[:id]) - @alias.set_email(params[:email_alias]) - flash[:notice] = t(:email_alias_updated_successfully) unless @alias.errors - respond_with @alias, :location => edit_user_path(@user, :anchor => :email) - end - def destroy - @alias = @user.get_email_alias(params[:id]) - flash[:notice] = t(:email_alias_destroyed_successfully) - @alias.destroy + @alias = @user.email_aliases.delete(params[:id]) + @user.save + flash[:notice] = t(:email_alias_destroyed_successfully, :alias => @alias) redirect_to edit_user_path(@user, :anchor => :email) end |