Backend Refactoring

This commit is contained in:
Dmitriy Zaporozhets 2012-07-31 08:32:49 +03:00
parent 69e41250d1
commit 5926bbac12
11 changed files with 151 additions and 78 deletions

View file

@ -1,30 +1,26 @@
class ProfileController < ApplicationController
layout "profile"
before_filter :user
def show
@user = current_user
end
def design
@user = current_user
end
def update
@user = current_user
@user.update_attributes(params[:user])
redirect_to :back
end
def token
@user = current_user
end
def password
@user = current_user
end
def password_update
params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
@user = current_user
if @user.update_attributes(params[:user])
flash[:notice] = "Password was successfully updated. Please login with it"
@ -38,4 +34,10 @@ class ProfileController < ApplicationController
current_user.reset_authentication_token!
redirect_to profile_token_path
end
private
def user
@user = current_user
end
end