Class: Georgia::UsersController
Instance Method Summary
collapse
#current_ability, #current_locale
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/georgia/users_controller.rb', line 22
def create
@user = User.new(params[:user])
if @user.save
redirect_to users_url, notice: "User was successfully created."
else
render 'new'
end
end
|
#destroy ⇒ Object
43
44
45
46
47
|
# File 'app/controllers/georgia/users_controller.rb', line 43
def destroy
@user = User.find(params[:id])
@user.destroy
redirect_to users_url, notice: "User was successfully deleted."
end
|
#edit ⇒ Object
18
19
20
|
# File 'app/controllers/georgia/users_controller.rb', line 18
def edit
@user = User.find(params[:id])
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/georgia/users_controller.rb', line 6
def index
@users = User.order(:created_at).page(params[:page])
end
|
#new ⇒ Object
14
15
16
|
# File 'app/controllers/georgia/users_controller.rb', line 14
def new
@user = User.new
end
|
#show ⇒ Object
10
11
12
|
# File 'app/controllers/georgia/users_controller.rb', line 10
def show
redirect_to edit_user_path(params[:id])
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/georgia/users_controller.rb', line 32
def update
@user = User.find(params[:id])
params[:user].delete(:password) if params[:user][:password].blank?
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
if @user.update_attributes(params[:user])
redirect_to users_url, notice: "User was successfully updated."
else
render 'edit'
end
end
|