X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8938ab79975d4152a4d6d3c8ceafdbda30b6b367..c37dc5c56d4be881e44500e1c8dde1826c0f78a7:/app/models/changeset_comment.rb?ds=sidebyside diff --git a/app/models/changeset_comment.rb b/app/models/changeset_comment.rb index 1b78f98e8..09eabe893 100644 --- a/app/models/changeset_comment.rb +++ b/app/models/changeset_comment.rb @@ -3,15 +3,18 @@ # Table name: changeset_comments # # id :integer not null, primary key -# changeset_id :bigint(8) not null -# author_id :bigint(8) not null +# changeset_id :bigint not null +# author_id :bigint not null # body :text not null # created_at :datetime not null # visible :boolean not null # # Indexes # -# index_changeset_comments_on_created_at (created_at) +# index_changeset_comments_on_author_id_and_created_at (author_id,created_at) +# index_changeset_comments_on_author_id_and_id (author_id,id) +# index_changeset_comments_on_changeset_id_and_created_at (changeset_id,created_at) +# index_changeset_comments_on_created_at (created_at) # # Foreign Keys # @@ -23,6 +26,8 @@ class ChangesetComment < ApplicationRecord belongs_to :changeset belongs_to :author, :class_name => "User" + scope :visible, -> { where(:visible => true) } + validates :id, :uniqueness => true, :presence => { :on => :update }, :numericality => { :on => :update, :only_integer => true } validates :changeset, :associated => true