aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-05-27 18:04:51 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-08 19:57:23 +0200
commitd8c6c62d1c73e6da20a1551d1f59122e852dd6f8 (patch)
tree9c34035686599f20948c1ba1cd78167823570d87 /app/models/question.rb
parentFix bug in spec support functions (diff)
downloadrecruiting-webapp-d8c6c62d1c73e6da20a1551d1f59122e852dd6f8.tar.gz
recruiting-webapp-d8c6c62d1c73e6da20a1551d1f59122e852dd6f8.tar.bz2
recruiting-webapp-d8c6c62d1c73e6da20a1551d1f59122e852dd6f8.zip
Easier question answering
Show question above answer. On question show page link to your answer for this question (if you answered it) or to create your answer for this question (if you didn't).
Diffstat (limited to 'app/models/question.rb')
-rw-r--r--app/models/question.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/question.rb b/app/models/question.rb
index f4ebffb..16ca9ac 100644
--- a/app/models/question.rb
+++ b/app/models/question.rb
@@ -20,4 +20,8 @@ class Question < ActiveRecord::Base
def answered?(user)
user.signed_up? && user.answered_questions.include?(self)
end
+
+ def answer_of(user)
+ answers.owner_is(user).first
+ end
end