-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with encrypted data #633
Comments
Here is some more information about the issue and what happened: The record could not be updated/created because the #<CustomAudit:0x00007fe4c5b531f8
id: nil,
auditable_id: "fe0186ee-46b2-470e-9055-c8a94bed6f2f",
auditable_type: "User",
associated_id: nil,
associated_type: nil,
user_id: nil,
user_type: nil,
username: nil,
action: "update",
audited_changes: {"name"=>["Teste 2", "test"], "encrypted_password"=>[nil, nil]},
version: 0,
comment: nil,
remote_address: nil,
request_uuid: nil,
created_at: nil> And here is the list of errors from this object: #<ActiveModel::Errors [
#<ActiveModel::Error attribute=user, type=blank, options={:message=>:required}>,
#<ActiveModel::Error attribute=associated, type=blank, options={:message=>:required}>
]> Not sure what caused the requirement of From what I can tell, this is caused by the |
This is definitely caused by the I can get it working if I do this, which I don't feel like it's a good idea: class CustomAudit < Audited::Audit
clear_validators!
encrypts :audited_changes
end |
May I ask if you're using require "audited/audit" anywhere in your application? Especially outside of on_load hooks? From what I can tell, the Audit class (and subclasses) should have these validations, but due to the way the model is loaded, they aren't initialized? This was noted in #375. I caught this in a project I'm working on because it does that require separately in order to patch the class, which after this change, causes the validations to be added. In either case, really seems like |
Any chances to make this happened? It looks like the must-have change for all Rails with |
I'm adding
audited
to a Rails project that use ActiveRecord Encryption and I'd like to encrypts theAudited::Audit#audited_changes
column so no PII is stored as plan text in the audit trail.I tried creating a custom Audit model for this, but it didn't work:
While trying to update a model I got validation errors saying "audits is invalid".
Do you guys have any recommendations or plans to work with AR encryption in the future?
The text was updated successfully, but these errors were encountered: