fix(admin): ignore active column
the attribut should be retrieve from the user model as the administrateur is no more a devise model
This commit is contained in:
parent
bcccd57573
commit
4babee2591
2 changed files with 8 additions and 2 deletions
|
@ -12,6 +12,8 @@
|
|||
class Administrateur < ApplicationRecord
|
||||
include ActiveRecord::SecureToken
|
||||
|
||||
self.ignored_columns = [:active]
|
||||
|
||||
UNUSED_ADMIN_THRESHOLD = 6.months
|
||||
|
||||
has_and_belongs_to_many :instructeurs
|
||||
|
@ -42,6 +44,10 @@ class Administrateur < ApplicationRecord
|
|||
user&.email
|
||||
end
|
||||
|
||||
def active?
|
||||
user&.active?
|
||||
end
|
||||
|
||||
def self.find_inactive_by_token(reset_password_token)
|
||||
self.inactive.with_reset_password_token(reset_password_token)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
describe Administrateurs::ProcedureAdministrateursController, type: :controller do
|
||||
let(:signed_in_admin) { create(:administrateur, active: true) }
|
||||
let(:other_admin) { create(:administrateur, active: true) }
|
||||
let(:signed_in_admin) { create(:administrateur).tap { _1.user.update(last_sign_in_at: Time.zone.now) } }
|
||||
let(:other_admin) { create(:administrateur).tap { _1.user.update(last_sign_in_at: Time.zone.now) } }
|
||||
let!(:administrateurs_procedure) { create(:administrateurs_procedure, administrateur: signed_in_admin, procedure: procedure, manager: manager) }
|
||||
let!(:procedure) { create(:procedure, administrateurs: [other_admin]) }
|
||||
render_views
|
||||
|
|
Loading…
Reference in a new issue