X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/53817fa9e8d955df0891d156f21b7269b4ed08fc..33799121b8a1ea5fdb1508ceda3fa99736db923f:/app/models/changeset_comment.rb?ds=sidebyside diff --git a/app/models/changeset_comment.rb b/app/models/changeset_comment.rb index 3bc9483fa..09eabe893 100644 --- a/app/models/changeset_comment.rb +++ b/app/models/changeset_comment.rb @@ -3,8 +3,8 @@ # 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 @@ -12,6 +12,7 @@ # Indexes # # 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) # @@ -25,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