Class: UsersController
Instance Method Summary
collapse
included
#current_ability
#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets
included
Instance Method Details
#destroy ⇒ Object
37
38
39
40
|
# File 'app/controllers/users_controller.rb', line 37
def destroy
current_user.destroy
redirect_to users_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
20
21
|
# File 'app/controllers/users_controller.rb', line 20
def edit
end
|
#index ⇒ Object
8
9
10
11
|
# File 'app/controllers/users_controller.rb', line 8
def index
parent = find_parent User::PARENT_TYPES
@users = parent ? parent.users : User.all
end
|
#languages ⇒ Object
13
14
15
|
# File 'app/controllers/users_controller.rb', line 13
def languages
render json: User.languages(params[:q]).to_json and return
end
|
#preferences ⇒ Object
23
24
25
26
27
|
# File 'app/controllers/users_controller.rb', line 23
def preferences
if params[:user] && current_user.update_attributes(params[:user])
redirect_to preferences_user_path(current_user), notice: t('general.form.successfully_updated') and return
end
end
|
#resource ⇒ Object
42
43
44
|
# File 'app/controllers/users_controller.rb', line 42
def resource
@user
end
|
#show ⇒ Object
17
18
|
# File 'app/controllers/users_controller.rb', line 17
def show
end
|
#update ⇒ Object
29
30
31
32
33
34
35
|
# File 'app/controllers/users_controller.rb', line 29
def update
if current_user.update_attributes(params[:user])
redirect_to edit_user_path(current_user), notice: t('general.form.successfully_updated')
else
render :edit
end
end
|