Added :inverse_of reference for all specific comment models. [fixes SCI-1207]

This commit is contained in:
Matej Zrimšek 2017-04-19 23:38:23 +02:00
parent a0b5a94d67
commit 314e8fcbd2
4 changed files with 5 additions and 4 deletions

View file

@ -1,5 +1,6 @@
class ProjectComment < Comment
belongs_to :project, foreign_key: :associated_id
belongs_to :project, foreign_key: :associated_id,
inverse_of: :project_comments
validates :project, presence: true
end

View file

@ -1,5 +1,5 @@
class ResultComment < Comment
belongs_to :result, foreign_key: :associated_id
belongs_to :result, foreign_key: :associated_id, inverse_of: :result_comments
validates :result, presence: true
end

View file

@ -1,5 +1,5 @@
class StepComment < Comment
belongs_to :step, foreign_key: :associated_id
belongs_to :step, foreign_key: :associated_id, inverse_of: :step_comments
validates :step, presence: true
end

View file

@ -1,5 +1,5 @@
class TaskComment < Comment
belongs_to :my_module, foreign_key: :associated_id
belongs_to :my_module, foreign_key: :associated_id, inverse_of: :task_comments
validates :my_module, presence: true
end