aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/answer.rb')
-rw-r--r--app/models/answer.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index f013547..47544b3 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -47,6 +47,11 @@ class Answer < ActiveRecord::Base
named_scope :in_category, lambda { |category| {
:joins => :question, :conditions => { 'questions.question_category_id', category} } }
+ named_scope :with_feedback, lambda { |opt| {
+ :conditions => { :feedback => opt } } }
+
+ named_scope :with_some_feedback, :conditions => "answers.feedback IS NOT NULL AND answers.feedback <> ''"
+
validates_uniqueness_of :question_id, :scope => :reference, :if => :reference
validates_uniqueness_of :question_id, :scope => :owner_id, :unless => :reference