From d6111d68356baa120b82c84aa2668982d880bfdb Mon Sep 17 00:00:00 2001 From: nilsding Date: Fri, 5 Dec 2014 14:11:08 +0100 Subject: [PATCH] added User#comment --- app/models/user.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 2a760a60..850ebb4a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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