Closed shlomizadok closed 9 years ago
I don't think this is the right way, caching of digest is actually a good idea. We should rather check before validation that the scap_file has changed and recalculate the digest in that case. Something like
before_validation_on_update :redigest, :if => { |c| c.scap_file_changed? }
@ares - agreed. Changed to before_validation
. As before_validation(:on_update)
is Rails4, I have added a check to the :if
, scap_content.persisted?
. Let me know what you think.
not tested but visually looks good to me :+1:
Merged as 8f533e9b6ae6876fc9bafa74a44079096db544c7. Thank You!
fixes https://github.com/OpenSCAP/foreman_openscap/issues/57