skill-assessment-app/app/controllers/admin/profile_controller.rb

29 lines
574 B
Ruby
Raw Normal View History

2016-08-24 10:43:33 -05:00
module Admin
2016-08-24 12:53:21 -05:00
class ProfileController < AdminController
2016-08-24 10:43:33 -05:00
def view
end
def edit
2016-08-24 12:53:21 -05:00
@user = current_admin
2016-08-24 10:43:33 -05:00
end
def update
2016-08-24 12:53:21 -05:00
@user = current_admin
if @user.update_attributes(user_params)
redirect_to admin_profile_path,
flash: { success: "Sucessfully updated profile" }
else
flash[:error] = "Failed to update profile."
render :edit
end
2016-08-24 10:43:33 -05:00
end
2016-08-24 15:02:32 -05:00
private
def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
2016-08-24 12:53:21 -05:00
end
2016-08-24 10:43:33 -05:00
end
end