Class: Option
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Option
- Defined in:
- app/models/option.rb
Instance Method Summary collapse
-
#response_percentage ⇒ Object
return the percentage of responses this option has.
- #should_destroy? ⇒ Boolean
Instance Method Details
#response_percentage ⇒ Object
return the percentage of responses this option has
8 9 10 11 |
# File 'app/models/option.rb', line 8 def response_percentage return 0 unless self.poll.response_count >= 1 sprintf("%0.1f", (self.response_count / self.poll.response_count.to_f) * 100.0) end |
#should_destroy? ⇒ Boolean
13 14 15 |
# File 'app/models/option.rb', line 13 def should_destroy? should_destroy.to_i == 1 end |