scinote-web/app/models/result_comment.rb
Luka Murn 24dd25d9f5 Add edit/delete result comment functionality
Lessons learned during this fix:
Don't use dependant: :destroy on both ends of association
between 2 ActiveRecords, or you will run into stack overflow.
2016-08-25 13:51:31 +02:00

8 lines
257 B
Ruby

class ResultComment < ActiveRecord::Base
validates :result, :comment, presence: true
validates :result_id, uniqueness: { scope: :comment_id }
belongs_to :result, inverse_of: :result_comments
belongs_to :comment,
inverse_of: :result_comment
end