models: set more creator names explicitly.

Set creators explicitly for bans, BURs, comment votes, and posts.
This commit is contained in:
evazion
2020-02-23 02:42:12 -06:00
parent 3a018ee9f7
commit e47d0e0d05
16 changed files with 18 additions and 64 deletions

View File

@@ -3,7 +3,6 @@ class CommentVote < ApplicationRecord
belongs_to :comment
belongs_to :user
before_validation :initialize_user, :on => :create
validates_presence_of :score
validates_uniqueness_of :user_id, :scope => :comment_id, :message => "have already voted for this comment"
validate :validate_user_can_vote
@@ -52,10 +51,6 @@ class CommentVote < ApplicationRecord
score == -1
end
def initialize_user
self.user_id = CurrentUser.user.id
end
def self.available_includes
[:comment, :user]
end