app/models/answer.rb in ask-0.5.2 vs app/models/answer.rb in ask-0.5.3
- old
+ new
@@ -1,18 +1,19 @@
class Answer < ActiveRecord::Base
+ if respond_to? :attr_accessible # Rails 3.2 backwards compatibility
+ attr_accessible :question_id, :answer, :choice_id, :uploaded_file, :uploaded_file_cache
+ end
- attr_accessible :question_id, :answer, :choice_id, :uploaded_file, :uploaded_file_cache
-
belongs_to :answerer, :polymorphic => true
belongs_to :question
belongs_to :choice
validates_presence_of :question_id
mount_uploader :uploaded_file, UploadedFileUploader
- default_scope joins(:question).order('questions.position').readonly(false) # This scope prevents updating answers unless readonly is set to false.
+ default_scope lambda { joins(:question).order('questions.position').readonly(false) } # This scope prevents updating answers unless readonly is set to false.
scope :for_answerer, lambda{|answerer| where(:answerer_type => answerer.class.to_s, :answerer_id => answerer.id)}
scope :for_question, lambda{|question| where(:question_id => question.id)}
def to_s
if question.supports_uploads?
@@ -31,7 +32,6 @@
else
answer.blank?
end
end
end
-
end