feat(manager): select team_user base on attribute

This commit is contained in:
simon lehericey 2022-11-17 13:57:41 +01:00 committed by LeSim
parent 6a0e0f12ad
commit 66e9b74121
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,8 @@ module Manager
class TeamAccountsController < Manager::ApplicationController
def index
@records_per_page = params[:records_per_page] || "10"
resources = User.marked_as_team_account
resources = User
.where(team_account: true)
.order(created_at: :asc)
.page(params[:_page])
.per(@records_per_page)

View file

@ -62,7 +62,6 @@ class User < ApplicationRecord
accepts_nested_attributes_for :france_connect_information
default_scope { eager_load(:instructeur, :administrateur, :expert) }
scope :marked_as_team_account, -> { where('email ilike ?', "%@beta.gouv.fr") }
before_validation -> { sanitize_email(:email) }
validate :does_not_merge_on_self, if: :requested_merge_into_id_changed?