ea8e9901f4
Your branch is behind 'origin/strong-params' by 1 commit, and can be fast-forwarded. I'll pull to catch up after this commit Change code to whitelist params Remove attr_accessible lines Add strong_params to Gemfile, since this branch is still on Rails 3 Mixin to ActiveRecord::Base ActiveModel::ForbiddenAttributesProtection Use an initializer for the mixin
17 lines
427 B
Ruby
17 lines
427 B
Ruby
class PaidTimeOff < ActiveRecord::Base
|
|
belongs_to :user
|
|
has_many :schedule, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
|
|
|
def sick_days_remaining
|
|
self.sick_days_earned - self.sick_days_taken
|
|
end
|
|
|
|
def pto_days_remaining
|
|
self.pto_earned - self.pto_taken
|
|
end
|
|
|
|
def sick_days_taken_percentage
|
|
result = self.sick_days_taken.to_f / self.sick_days_earned.to_f * 100.0
|
|
end
|
|
end
|