gitlab-org--gitlab-foss/app/models/application_setting/term.rb
tauriedavis 285ffb2238 Messaging on terms page when user already accepted
We show a blue flash banner if the user already accepted, and show a
button allowing them to continue to the application.
2018-06-04 22:22:11 +02:00

19 lines
389 B
Ruby

class ApplicationSetting
class Term < ActiveRecord::Base
include CacheMarkdownField
has_many :term_agreements
validates :terms, presence: true
cache_markdown_field :terms
def self.latest
order(:id).last
end
def accepted_by_user?(user)
user.accepted_term_id == id ||
term_agreements.accepted.where(user: user).exists?
end
end
end