check if clients are editable

This commit is contained in:
Stefan Tollkühn
2025-07-21 16:00:37 +02:00
parent bd0f65a323
commit 0ea5e5926f
2 changed files with 32 additions and 58 deletions

View File

@@ -5,4 +5,12 @@ class Client < ApplicationRecord
validates :company_name, :firstname, :lastname, presence: true
# Add other validations as needed
def referenced_count
owner_subprojects.count + builder_subprojects.count + client_subprojects.count
end
def editable?
referenced_count <= 1
end
end