debian-mirror-gitlab/app/models/application_setting/term.rb

22 lines
420 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
class ApplicationSetting
class Term < ActiveRecord::Base
include CacheMarkdownField
2018-11-08 19:23:39 +05:30
has_many :term_agreements
2018-10-15 14:42:47 +05:30
validates :terms, presence: true
cache_markdown_field :terms
def self.latest
order(:id).last
end
2018-11-08 19:23:39 +05:30
def accepted_by_user?(user)
user.accepted_term_id == id ||
term_agreements.accepted.where(user: user).exists?
end
2018-10-15 14:42:47 +05:30
end
end