entrance-exam/app/models/extension.rb

21 lines
424 B
Ruby

# == Schema Information
#
# Table name: extensions
#
# id :integer not null, primary key
# confirmed :boolean
# reason :text
# created_at :datetime not null
# updated_at :datetime not null
#
class Extension < ApplicationRecord
def affect_deadline(deadline)
return deadline unless confirmed
deadline + 6.weeks
end
def confirm!
update!(confirmed: true)
end
end