added User#comment

This commit is contained in:
nilsding 2014-12-05 14:11:08 +01:00
parent 641fa1ddc3
commit d6111d6835
1 changed files with 10 additions and 0 deletions

View File

@ -100,4 +100,14 @@ class User < ActiveRecord::Base
rescue NoMethodError
website
end
def comment(answer, content)
Comment.create(user: self, answer: answer, content: content)
increment! :commented_count
answer.increment! :comment_count
end
def destroy_comment(comment)
# TODO: implement this
end
end