Generates Task model and adds relative unit tests
This commit is contained in:
parent
66038c6afb
commit
5584e328b1
8 changed files with 64 additions and 2 deletions
|
|
@ -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
7
app/models/task.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class Task < ApplicationRecord
|
||||
validates :name, presence: true
|
||||
validates :user, presence: true
|
||||
|
||||
belongs_to :activity
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue