added User#answered?
This commit is contained in:
parent
7be7de11cd
commit
496ff61a65
|
@ -101,6 +101,13 @@ class User < ActiveRecord::Base
|
||||||
question: question)
|
question: question)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# has the user answered +question+ yet?
|
||||||
|
# @param question [Question]
|
||||||
|
def answered?(question)
|
||||||
|
question.answers.each { |a| return true if a.user_id == self.id }
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
# smiles an answer
|
# smiles an answer
|
||||||
# @param answer [Answer] the answer to smile
|
# @param answer [Answer] the answer to smile
|
||||||
def smile(answer)
|
def smile(answer)
|
||||||
|
|
Loading…
Reference in New Issue