1 # == Schema Information
3 # Table name: changeset_comments
5 # id :integer not null, primary key
6 # changeset_id :bigint(8) not null
7 # author_id :bigint(8) not null
9 # created_at :datetime not null
10 # visible :boolean not null
14 # index_changeset_comments_on_author_id_and_created_at (author_id,created_at)
15 # index_changeset_comments_on_changeset_id_and_created_at (changeset_id,created_at)
16 # index_changeset_comments_on_created_at (created_at)
20 # changeset_comments_author_id_fkey (author_id => users.id)
21 # changeset_comments_changeset_id_fkey (changeset_id => changesets.id)
24 class ChangesetComment < ApplicationRecord
26 belongs_to :author, :class_name => "User"
28 validates :id, :uniqueness => true, :presence => { :on => :update },
29 :numericality => { :on => :update, :only_integer => true }
30 validates :changeset, :associated => true
31 validates :author, :associated => true
32 validates :visible, :inclusion => [true, false]
33 validates :body, :characters => true
35 # Return the comment text
37 RichText.new("text", self[:body])