scinote-web/app/models/sample_comment.rb

8 lines
253 B
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
class SampleComment < ActiveRecord::Base
validates :comment, :sample, presence: true
validates :sample_id, uniqueness: { scope: :comment_id }
belongs_to :comment, inverse_of: :sample_comment
belongs_to :sample, inverse_of: :sample_comments
end