OpenSCAP / scaptimony

SCAPtimony is SCAP database and storage server
GNU General Public License v3.0
13 stars 13 forks source link

fixes foreman_openscap#57 - update digest when replacing file #20

Closed shlomizadok closed 9 years ago

shlomizadok commented 9 years ago

fixes https://github.com/OpenSCAP/foreman_openscap/issues/57

ares commented 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? }

shlomizadok commented 9 years ago

@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.

ares commented 9 years ago

not tested but visually looks good to me :+1:

isimluk commented 9 years ago

Merged as 8f533e9b6ae6876fc9bafa74a44079096db544c7. Thank You!