Validate e-mail when country is other than estonia

This commit is contained in:
Martin Lensment 2014-09-30 12:55:21 +03:00
parent 0dc0cc63d9
commit 42b1890bf5
4 changed files with 20 additions and 4 deletions

View file

@ -14,10 +14,10 @@ class Admin::UsersController < AdminController
@user = User.new(user_params)
if @user.save
flash[:notice] = I18n.t('shared.user_added')
flash[:notice] = I18n.t('shared.record_created')
redirect_to [:admin, @user]
else
flash.now[:alert] = I18n.t('shared.failed_to_add_user')
flash.now[:alert] = I18n.t('shared.failed_to_create_record')
render 'new'
end
end
@ -36,6 +36,16 @@ class Admin::UsersController < AdminController
end
end
def destroy
if @user.destroy
flash[:notice] = I18n.t('shared.record_deleted')
redirect_to admin_users_path
else
flash.now[:alert] = I18n.t('shared.failed_to_delete_record')
render 'show'
end
end
private
def set_user