X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/cb87f02642d0097ebc067ca1f9371dde274a41e3..b75cf73a5480600b2d53cceec2a230122f61b8fa:/app/models/diary_comment.rb?ds=inline diff --git a/app/models/diary_comment.rb b/app/models/diary_comment.rb index 8a99c7b2c..4ae21be88 100644 --- a/app/models/diary_comment.rb +++ b/app/models/diary_comment.rb @@ -2,9 +2,9 @@ # # Table name: diary_comments # -# id :integer not null, primary key -# diary_entry_id :integer not null -# user_id :integer not null +# id :bigint(8) not null, primary key +# diary_entry_id :bigint(8) not null +# user_id :bigint(8) not null # body :text not null # created_at :datetime not null # updated_at :datetime not null @@ -26,7 +26,9 @@ class DiaryComment < ActiveRecord::Base belongs_to :user belongs_to :diary_entry - validates :body, :presence => true + scope :visible, -> { where(:visible => true) } + + validates :body, :presence => true, :characters => true validates :diary_entry, :user, :associated => true after_save :spam_check