Class: Survey::Answer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Survey::Answer
- Defined in:
- app/models/survey/answer.rb
Instance Method Summary collapse
Instance Method Details
#correct? ⇒ Boolean
24 25 26 |
# File 'app/models/survey/answer.rb', line 24 def correct? self.correct ||= self.option.correct? end |
#value ⇒ Object
19 20 21 22 |
# File 'app/models/survey/answer.rb', line 19 def value points = (self.option.nil? ? Survey::Option.find(option_id) : self.option).weight correct?? points : - points end |