Class: Comable::Admin::UsersController

Inherits:
ApplicationController show all
Includes:
PermittedAttributes
Defined in:
app/controllers/comable/admin/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability, #respond_to_export_with

Instance Method Details

#editObject



23
24
# File 'app/controllers/comable/admin/users_controller.rb', line 23

def edit
end

#indexObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/comable/admin/users_controller.rb', line 10

def index
  @q = Comable::User.ransack(params[:q])
  @users = @q.result.page(params[:page]).accessible_by(current_ability).by_newest

  respond_to do |format|
    format.html
    format.json { render json: @users }
  end
end

#profileObject



35
36
37
38
# File 'app/controllers/comable/admin/users_controller.rb', line 35

def profile
  @user = current_comable_user
  render :edit
end

#showObject



20
21
# File 'app/controllers/comable/admin/users_controller.rb', line 20

def show
end

#updateObject



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

def update
  if @user.update_attributes(user_params)
    redirect_to comable.admin_user_path(@user), notice: Comable.t('successful')
  else
    flash.now[:alert] = Comable.t('failure')
    render :edit
  end
end