diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-29 17:44:39 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-29 17:44:39 +0800 |
commit | 9d8dca08e440ccb730f20dcd79b3b47aef8aeb2e (patch) | |
tree | 0941c709655e72f6671e7408b72f83416c785203 /app/models/ci/build.rb | |
parent | 1bc0d732f604d7a4a616ba34b8ccbb1987038951 (diff) | |
download | gitlab-ce-9d8dca08e440ccb730f20dcd79b3b47aef8aeb2e.tar.gz |
Use AR callbacks as suggested by:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4964#note_12744656
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 0f8c9511ce1..2079d5a2178 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -19,6 +19,7 @@ module Ci acts_as_taggable + before_save :update_artifacts_size, if: :artifacts_file_changed? before_destroy { project } after_create :execute_hooks @@ -340,7 +341,6 @@ module Ci def erase_artifacts! remove_artifacts_file! remove_artifacts_metadata! - self.artifacts_size = nil save end @@ -381,6 +381,10 @@ module Ci private + def update_artifacts_size + self.artifacts_size = artifacts_file.size + end + def erase_trace! self.trace = nil end |