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
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
Method to find and edit the user.
# File app/controllers/admin/users_controller.rb, line 63 def edit @user = User.find(params[:id]) end
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
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
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
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
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
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
Method to find user.
# File app/controllers/admin/users_controller.rb, line 91 def user_transactions @user = User.find(params[:id]) end