This commit is contained in:
nilsding 2014-12-28 19:32:08 +01:00
parent 90fe42e643
commit 774cf8df99
1 changed files with 9 additions and 0 deletions

View File

@ -126,4 +126,13 @@ class User < ActiveRecord::Base
increment! :commented_count increment! :commented_count
answer.increment! :comment_count answer.increment! :comment_count
end end
# @return [Boolean] is the user a moderator?
def mod?
self.moderator? || self.admin?
end
def report(object)
Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id)
end
end end