Class: Rule
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Rule
- Defined in:
- app/models/rule.rb
Instance Method Summary collapse
Instance Method Details
#activate ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/rule.rb', line 13 def activate activation_state = !self.active? self.update_attribute(:active, activation_state) children.each do |child| child.update_attribute(:active,activation_state) end end |
#description ⇒ Object
26 27 28 29 |
# File 'app/models/rule.rb', line 26 def description return super unless parent super || parent.description end |
#name ⇒ Object
21 22 23 24 |
# File 'app/models/rule.rb', line 21 def name return super unless parent super || parent.name end |
#usage ⇒ Object
8 9 10 11 |
# File 'app/models/rule.rb', line 8 def usage #activated = false if max_use && max_use > 0 && use >= max_use #self.active = true end |