1 # == Schema Information
3 # Table name: changeset_comments
5 # id :integer not null, primary key
6 # changeset_id :integer not null
7 # author_id :integer not null
9 # created_at :datetime not null
10 # visible :boolean not null
14 # index_changeset_comments_on_created_at (created_at)
18 # changeset_comments_author_id_fkey (author_id => users.id)
19 # changeset_comments_changeset_id_fkey (changeset_id => changesets.id)
22 class ChangesetComment < ActiveRecord::Base
24 belongs_to :author, :class_name => "User"
26 validates :id, :uniqueness => true, :presence => { :on => :update },
27 :numericality => { :on => :update, :integer_only => true }
28 validates :changeset, :presence => true, :associated => true
29 validates :author, :presence => true, :associated => true
30 validates :visible, :inclusion => [true, false]
31 validates :body, :invalid_chars => true
33 # Return the comment text
35 RichText.new("text", self[:body])