X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f5c5aacb209fd209c0b13203c0c7d0259635c671..0cd18eb02f853bfa93673f046b793bd53ac5aa68:/app/models/diary_comment.rb diff --git a/app/models/diary_comment.rb b/app/models/diary_comment.rb index 8663212eb..ad23c9f65 100644 --- a/app/models/diary_comment.rb +++ b/app/models/diary_comment.rb @@ -15,6 +15,7 @@ # # diary_comment_user_id_created_at_index (user_id,created_at) # diary_comments_entry_id_idx (diary_entry_id,id) UNIQUE +# index_diary_comments_on_user_id_and_id (user_id,id) # # Foreign Keys # @@ -23,7 +24,7 @@ # class DiaryComment < ApplicationRecord - belongs_to :user + belongs_to :user, :counter_cache => true belongs_to :diary_entry scope :visible, -> { where(:visible => true) } @@ -42,7 +43,7 @@ class DiaryComment < ApplicationRecord sha256 << Rails.application.key_generator.generate_key("openstreetmap/diary_comment") sha256 << id.to_s sha256 << subscriber.to_s - sha256.base64digest[0, 8] + Base64.urlsafe_encode64(sha256.digest)[0, 8] end private