Generates Task model and adds relative unit tests

This commit is contained in:
Lou 2021-05-10 16:12:45 +02:00
commit 5584e328b1
8 changed files with 64 additions and 2 deletions

View file

@ -4,6 +4,8 @@ class Activity < ApplicationRecord
has_one :joined_user_activity
has_one :user, :through => :joined_user_activity
has_many :tasks
validates :name, presence: true
validates :author, presence: true
end

7
app/models/task.rb Normal file
View file

@ -0,0 +1,7 @@
class Task < ApplicationRecord
validates :name, presence: true
validates :user, presence: true
belongs_to :activity
belongs_to :user
end

View file

@ -9,5 +9,7 @@ class User < ApplicationRecord
has_many :joined_user_activities
has_many :activities, :through => :joined_user_activities
has_many :tasks
has_secure_password
end