Class: Rule

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/rule.rb

Instance Method Summary collapse

Instance Method Details

#activateObject



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

#descriptionObject



26
27
28
29
# File 'app/models/rule.rb', line 26

def description
  return super unless parent
  super || parent.description
end

#nameObject



21
22
23
24
# File 'app/models/rule.rb', line 21

def name
  return super unless parent
  super || parent.name
end

#usageObject



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