Module: Counter::Verifyable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Value
- Defined in:
- app/models/concerns/counter/verifyable.rb
Instance Method Summary collapse
Instance Method Details
#correct! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/concerns/counter/verifyable.rb', line 12 def correct! # We can't verify these values return true if definition.global? old_value, new_value = verify requires_recalculation = old_value != new_value update! value: new_value if requires_recalculation !requires_recalculation end |
#correct? ⇒ Boolean
4 5 6 7 8 9 10 |
# File 'app/models/concerns/counter/verifyable.rb', line 4 def correct? # We can't verify these values return true if definition.global? old_value, new_value = verify old_value == new_value end |
#verify ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/models/concerns/counter/verifyable.rb', line 24 def verify if definition.calculated? [calculate, value] else [count_by_sql, value] end end |