Class: UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#_edition_exists, #after_sign_in_path_for, #deny_access, #expansion_exists, #fill_platforms, #game_exists, #game_maker_only, #has_query, #ignore_referral_spam, #reviewer_only, #work_exists, #xhr_only

Instance Method Details

#destroyObject


50
51
52
53
54
55
# File 'app/controllers/users_controller.rb', line 50

def destroy
	user = User.find(params[:id])
	authorize user
	user.destroy
	redirect_to users_path, :notice => "User deleted."
end

#finish_signupObject


35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/users_controller.rb', line 35

def 
	@user = User.find(params[:id])
	authorize @user
	if request.patch? && params[:user]
		@user.attributes = user_params
		@user.skip_reconfirmation!
		if @user.save
			(@user, :bypass => true)
			redirect_to @user, notice: 'Your profile was successfully updated.'
		else
			@show_errors = true
		end
	end
end

#identitiesObject


15
16
17
18
19
20
21
22
23
# File 'app/controllers/users_controller.rb', line 15

def identities
	@user = current_user
	authorize @user
	ret_identities = Identity.where(user_id: @user.id)
	@identities = {}
	ret_identities.each do |i|
		@identities[i.provider] = i
	end
end

#indexObject


5
6
7
8
# File 'app/controllers/users_controller.rb', line 5

def index
	@users = User.all
	authorize User
end

#showObject


10
11
12
13
# File 'app/controllers/users_controller.rb', line 10

def show
	@user = User.find(params[:id])
	authorize @user
end

#updateObject


25
26
27
28
29
30
31
32
33
# File 'app/controllers/users_controller.rb', line 25

def update
	@user = User.find(params[:id])
	authorize @user
	if @user.update_attributes(secure_params)
		redirect_to users_path, :notice => "User updated."
	else
		redirect_to users_path, :alert => "Unable to update user."
	end
end