answer is now returned in Inbox#answer

This commit is contained in:
nilsding 2014-12-12 23:14:32 +01:00
parent e2cabbe934
commit 5aab94207a
1 changed files with 4 additions and 3 deletions

View File

@ -3,12 +3,13 @@ class Inbox < ActiveRecord::Base
belongs_to :question belongs_to :question
def answer(answer, user) def answer(answer, user)
Answer.create!(content: answer, answer = Answer.create!(content: answer,
user: user, user: user,
question: self.question) question: self.question)
user.increment! :answered_count user.increment! :answered_count
self.question.increment! :answer_count self.question.increment! :answer_count
self.destroy self.destroy
answer
end end
def remove def remove