summaryrefslogtreecommitdiff
path: root/app/controllers/my
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-09-19 22:18:50 -0600
committermo khan <mo@mokhan.ca>2014-09-19 22:18:50 -0600
commit098c823cc78316748c5920a2f94e8ff8ab31e721 (patch)
tree4da01620f67a747ecf631e490b87087320c52f9c /app/controllers/my
parente7db16175ede56d745635d842f42c268314d3884 (diff)
switch up avatar controller to upload a new photo.
Diffstat (limited to 'app/controllers/my')
-rw-r--r--app/controllers/my/avatars_controller.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/app/controllers/my/avatars_controller.rb b/app/controllers/my/avatars_controller.rb
index 8d9c9cef..0b4123af 100644
--- a/app/controllers/my/avatars_controller.rb
+++ b/app/controllers/my/avatars_controller.rb
@@ -1,24 +1,12 @@
module My
class AvatarsController < BaseController
- before_action :find_or_build_avatar
-
- def edit
+ def new
+ @avatar = current_user.avatar || Photo.new
end
- def update
+ def create
UploadAvatar.new.run(current_user, params)
- redirect_to edit_my_avatar_path(current_user), :notice => t(:avatar_uploaded)
- end
-
- protected
-
- def find_or_build_avatar
- if current_user.avatar == nil
- @avatar = current_user.avatar = Avatar.new
- current_user.save
- else
- @avatar = current_user.avatar
- end
+ redirect_to new_my_avatar_path, notice: t(:avatar_uploaded)
end
end
end