class Admin::UsersController

Public Instance Methods

activate() click to toggle source

Method to update the user i.e. set user as active.

# File app/controllers/admin/users_controller.rb, line 19
def activate
  respond_to do |format|
    if resource.update_attribute(:is_manually_deactivated, 'false')
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to activate.'}
    end
  end
end
deactivate() click to toggle source

Method to update the user i.e. set user as deactive.

# File app/controllers/admin/users_controller.rb, line 30
def deactivate
  respond_to do |format|
    if resource.update_attribute(:is_manually_deactivated, 'true')
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to deactivate.'}
    end
  end
end
edit() click to toggle source

Method to find and edit the user.

# File app/controllers/admin/users_controller.rb, line 63
def edit
  @user = User.find(params[:id])
end
mark_admin() click to toggle source

Method to update user as admin.

# File app/controllers/admin/users_controller.rb, line 41
def mark_admin
  respond_to do |format|
    if resource.update_attribute(:admin, '1')
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to add as admin.'}
    end
  end
end
resend_activation() click to toggle source

Method to resend the activation email to user.

# File app/controllers/admin/users_controller.rb, line 6
def resend_activation
  unless resource.active?
    UserMailer.delay(queue: :mailer).activation_needed_email(resource, true)
    @message = 'Activation email send to user.'
  else
    @message = "User is already activated."
  end
  respond_to do |format|
    format.js {}
  end
end
unmark_admin() click to toggle source

Method to update user i.e. admin set to false

# File app/controllers/admin/users_controller.rb, line 52
def unmark_admin
  respond_to do |format|
    if resource.update_attribute(:admin, '0')
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to remove from admin.'}
    end
  end
end
update() click to toggle source

Method to find and update the user.

# File app/controllers/admin/users_controller.rb, line 68
def update
  @user = User.find(params[:id])
  @user.update_searchable = true
  @user.attributes = params[:tutor]
  if @user.save(:validate => false)
    flash[:notice] = "User has been updated successfully."
    render :update
  end
end
upload_image() click to toggle source

Method to get all searchable records of user.

# File app/controllers/admin/users_controller.rb, line 79
def upload_image
  @user = User.find(params[:id])
  @user.update_attributes(user_params)
end
user_activity() click to toggle source

Method to find and fetch all user request logs.

# File app/controllers/admin/users_controller.rb, line 85
def user_activity
  @user = User.find(params[:id])
  @request_log = @user.request_logs
end
user_transactions() click to toggle source

Method to find user.

# File app/controllers/admin/users_controller.rb, line 91
def user_transactions
  @user = User.find(params[:id])
end