! (again)
This commit is contained in:
parent
384cc7f5ea
commit
7b5454a1bd
|
@ -3,7 +3,7 @@ class Inbox < ActiveRecord::Base
|
||||||
belongs_to :question
|
belongs_to :question
|
||||||
|
|
||||||
def answer(answer, user)
|
def answer(answer, user)
|
||||||
Answer.create(content: answer,
|
Answer.create!(content: answer,
|
||||||
user: user,
|
user: user,
|
||||||
question: self.question)
|
question: self.question)
|
||||||
user.increment! :answered_count
|
user.increment! :answered_count
|
||||||
|
@ -12,7 +12,6 @@ class Inbox < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove
|
def remove
|
||||||
self.question.decrement! :answer_count
|
|
||||||
unless self.question.user.nil?
|
unless self.question.user.nil?
|
||||||
self.question.user.decrement! :asked_count if self.question.answer_count == 1
|
self.question.user.decrement! :asked_count if self.question.answer_count == 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue