Validate form data
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
class Project < ApplicationRecord
|
class Project < ApplicationRecord
|
||||||
has_many :tasks
|
has_many :tasks, dependent: :destroy
|
||||||
|
|
||||||
|
validates :project_name, :description, presence: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ class Task < ApplicationRecord
|
|||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
enum :status, { to_do: 0, in_progress: 1, done: 2 }
|
enum :status, { to_do: 0, in_progress: 1, done: 2 }
|
||||||
|
|
||||||
|
validates :title, presence: true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user