2010-11-06 09:15:10 -07:00
|
|
|
class UsersController < ApplicationController
|
2011-07-20 12:16:22 -07:00
|
|
|
before_filter :find_and_authorize_user!, :only => [:update]
|
|
|
|
|
2010-11-06 09:15:10 -07:00
|
|
|
def top_contributors
|
|
|
|
@users = User.top_contributors.paginate :page => params[:page], :per_page => 20
|
|
|
|
end
|
2011-07-20 12:16:22 -07:00
|
|
|
|
|
|
|
def update
|
|
|
|
@user.update_attributes params[:user]
|
|
|
|
flash[:success] = "Settings successfully saved"
|
|
|
|
redirect_back! user_closet_hangers_path(@user)
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def find_and_authorize_user!
|
|
|
|
if current_user.id == params[:id].to_i
|
|
|
|
@user = current_user
|
|
|
|
else
|
|
|
|
raise AccessDenied
|
|
|
|
end
|
|
|
|
end
|
2010-11-06 09:15:10 -07:00
|
|
|
end
|
2011-07-20 12:16:22 -07:00
|
|
|
|