Merge pull request #565 from mz3944/mz-SCI-1207

Added :inverse_of reference for all specific comment models
This commit is contained in:
okriuchykhin 2017-04-20 09:52:02 +02:00 committed by GitHub
commit c57589781c
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