Class: ApplicationRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ApplicationRecord
show all
- Defined in:
- app/models/application_record.rb
Direct Known Subclasses
Account, AccountLoginStat, Accreditation, AccreditedIndividual, AccreditedOrganization, AppealSubmission, AppealSubmissionUpload, AsyncTransaction::Base, AverageDaysForClaimCompletion, CentralMailSubmission, ClaimVANotification, ClaimsApi::ClaimSubmission, DecisionReviewNotificationAuditLog, DeprecatedUserAccount, DisabilityContention, EVSSClaim, EducationBenefitsClaim, EducationBenefitsSubmission, EducationStemAutomatedDecision, FeatureToggleEvent, Form1010cg::Submission, Form1095B, Form526JobStatus, Form526Submission, Form526SubmissionRemediation, FormAttachment, FormEmailMatchesProfileLog, FormSubmission, FormSubmissionAttempt, GibsNotFoundUser, HealthCareApplication, IdCardAnnouncementSubscription, InProgressForm, IntentToFileQueueExhaustion, InvalidLetterAddressEdipi, IvcChampvaForm, Lighthouse526DocumentUpload, MHVOptInFlag, MaintenanceWindow, NodNotification, OnsiteNotification, PersistentAttachment, PersonalInformationLog, Preneeds::PreneedSubmission, SavedClaim, SchemaContract::Validation, SecondaryAppealForm, SignIn::ClientConfig, SignIn::OAuthSession, SignIn::ServiceAccountConfig, SpoolFileEvent, TermsOfUseAgreement, UserAcceptableVerifiedCredential, UserAccount, UserCredentialEmail, UserVerification, VeteranOnboarding, Webhooks::Notification, Webhooks::NotificationAttempt, Webhooks::NotificationAttemptAssoc, Webhooks::Subscription
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.descendants_using_encryption ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/models/application_record.rb', line 15
def self.descendants_using_encryption
Rails.application.eager_load!
ApplicationRecord.descendants.select do |model|
model = model.name.constantize
model.descendants.empty? &&
model.respond_to?(:lockbox_attributes) &&
model.lockbox_attributes.any?
end
end
|
.lockbox_options ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'app/models/application_record.rb', line 6
def self.lockbox_options
{
previous_versions: [
{ padding: false },
{ padding: false, master_key: Settings.lockbox.master_key }
]
}
end
|
Instance Method Details
#timestamp_attributes_for_update_in_model ⇒ Object
25
26
27
28
29
30
31
|
# File 'app/models/application_record.rb', line 25
def timestamp_attributes_for_update_in_model
kms_key_changed = changed? && changed.include?('encrypted_kms_key')
called_from_kms_encrypted = caller_locations(1, 1)[0].label == 'encrypt_kms_keys'
kms_key_changed || called_from_kms_encrypted ? [] : super
end
|
#valid?(context = nil) ⇒ Boolean
33
34
35
36
37
38
39
40
|
# File 'app/models/application_record.rb', line 33
def valid?(context = nil)
kms_key_changed = changed.include?('encrypted_kms_key')
only_kms_changes = changed.all? { |f| f == 'encrypted_kms_key' || f.include?('_ciphertext') }
kms_key_changed && only_kms_changes ? true : super
end
|