Project create

This commit is contained in:
2025-06-22 18:31:03 +03:00
parent 717e64a034
commit 864769e70a
3 changed files with 32 additions and 1 deletions
+11
View File
@@ -1,12 +1,23 @@
class Project < ApplicationRecord
validates :name, :code, presence: true
validates :code, exclusion: { in: %w[new] }, uniqueness: true
has_many :tasks
has_rich_text :description
before_validation :lowercase_code
def to_param
return unless id
code
end
private
def lowercase_code
return if code.blank?
self.code = self.code.downcase
end
end