Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Course < ActiveRecord::Base
- has_many :scheduled_runs
- attr_accessor :hours, :minutes
- before_save :set_duration_from_hours_and_mins
- private
- def set_duration_from_hours_and_mins
- self.duration = (self.hours.to_i.hours + self.minutes.to_i.minutes).to_i
- end
- end
Add Comment
Please, Sign In to add comment