allpro/app/models/workout.rb

16 lines
337 B
Ruby
Raw Permalink Normal View History

2013-08-04 20:58:01 -04:00
class Workout < ActiveRecord::Base
2013-08-12 03:31:42 -04:00
has_many :lifts, dependent: :destroy
2013-08-11 13:40:44 -04:00
DAY_TYPES = [:heavy, :medium, :light ]
2013-08-10 09:24:49 -04:00
validates_date :date
2013-08-10 22:15:26 -04:00
validates_inclusion_of :day_type, :in => Workout::DAY_TYPES
2013-08-11 13:40:44 -04:00
def day_type
read_attribute(:day_type).to_sym
end
def day_type=(value)
write_attribute(:day_type, value.to_s)
end
2013-08-04 20:58:01 -04:00
end