Sha256: 8573298ad5bf94fbaf0c6982c191be21ba822aff55dda5c3f1e25172b1f753a5
Contents?: true
Size: 622 Bytes
Versions: 6
Compression:
Stored size: 622 Bytes
Contents
class Rule < ActiveRecord::Base acts_as_tree before_save :usage serialize :variables validates :name, :conditions, :presence => true def usage #activated = false if max_use && max_use > 0 && use >= max_use #self.active = true end def activate activation_state = !self.active? self.update_attribute(:active, activation_state) children.each do |child| child.update_attribute(:active,activation_state) end end def name return super unless parent super || parent.name end def description return super unless parent super || parent.description end end
Version data entries
6 entries across 6 versions & 1 rubygems