Sha256: eb0bc5f742f7cfc882c0e9b69a32966de942c04bc66c5c9412cf5fa84db73fd7
Contents?: true
Size: 610 Bytes
Versions: 103
Compression:
Stored size: 610 Bytes
Contents
module CalculateStat def self.included(base) base.extend ClassMethods base.send :include, InstanceMethods base.class_eval do validates_presence_of :start_date, :end_date validate :check_date end end module ClassMethods def calculate_stat self.not_calculated.each do |stat| stat.aasm_calculate! end end end module InstanceMethods def check_date if self.start_date and self.end_date if self.start_date >= self.end_date errors.add(:start_date) errors.add(:end_date) end end end end end
Version data entries
103 entries across 94 versions & 3 rubygems