diff options
Diffstat (limited to 'app/models/version.rb')
-rw-r--r-- | app/models/version.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index b8c7b6f60..9910700f2 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -227,6 +227,10 @@ class Version < ActiveRecord::Base sharing != 'none' end + def deletable? + fixed_issues.empty? && !referenced_by_a_custom_field? + end + private def load_issue_counts @@ -288,4 +292,9 @@ class Version < ActiveRecord::Base progress end end + + def referenced_by_a_custom_field? + CustomValue.joins(:custom_field). + where(:value => id.to_s, :custom_fields => {:field_format => 'version'}).any? + end end |