Fixed double versioning on domains

This commit is contained in:
Andres Keskküla 2014-10-20 13:50:17 +03:00
parent 6b783fd45e
commit 7c3740acba
5 changed files with 20 additions and 10 deletions

View file

@ -39,12 +39,8 @@ class DomainContact < ActiveRecord::Base
end
def domain_snapshot
# We don't create a version unless domain is valid, is that a good idea?
return true unless PaperTrail.enabled?
return true if domain.nil?
return true if contact.nil?
return true if domain.versions.last.try(:snapshot) == domain.try(:create_snapshot)
domain.touch_with_version if domain.valid?
domain.create_version
true
end
end