kaps_app/app/models/kapsme.rb
Nicolas Bally 602f61fde7 Suite
2020-02-02 22:24:38 +01:00

32 lines
465 B
Ruby

class Kapsme < ActiveRecord::Base
belongs_to :kap
belongs_to :p_customer
has_many :kaps_rappels, :through => :kap
def kaps_type
if self.kaps_type_id == 1
"Journalier"
elsif self.kaps_type_id == 2
"Hebdomadaire"
else
"Mensuel"
end
end
before_save do
if self.paused
self.point_to_count = 0
else
self.point_to_count = self.points
end
end
belongs_to :kaps_day
end