Guest User

Untitled

a guest
Jun 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. class Course < ActiveRecord::Base
  2. has_many :scheduled_runs
  3.  
  4. attr_accessor :hours, :minutes
  5.  
  6. before_save :set_duration_from_hours_and_mins
  7.  
  8. private
  9. def set_duration_from_hours_and_mins
  10. self.duration = (self.hours.to_i.hours + self.minutes.to_i.minutes).to_i
  11. end
  12. end
Add Comment
Please, Sign In to add comment