summaryrefslogtreecommitdiff
path: root/app/models/application_setting/term.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-24 18:28:04 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-05-04 13:52:55 +0200
commit3d6d0a09b65f032bbe1bd5ad4736dd764195bbe1 (patch)
tree72225f4bd77687266020a1391b5604478b67318c /app/models/application_setting/term.rb
parentcf37bef287d7dd5d2dce3e2276489767b8c0671f (diff)
downloadgitlab-ce-3d6d0a09b65f032bbe1bd5ad4736dd764195bbe1.tar.gz
Store application wide terms
This allows admins to define terms in the application settings. Every time the terms are adjusted, a new version is stored and becomes the 'active' version. This allows tracking which specific version was accepted by a user.
Diffstat (limited to 'app/models/application_setting/term.rb')
-rw-r--r--app/models/application_setting/term.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/application_setting/term.rb b/app/models/application_setting/term.rb
index 1f3d20e2b75..e8ce0ccbb71 100644
--- a/app/models/application_setting/term.rb
+++ b/app/models/application_setting/term.rb
@@ -1,5 +1,13 @@
class ApplicationSetting
class Term < ActiveRecord::Base
+ include CacheMarkdownField
+
validates :terms, presence: true
+
+ cache_markdown_field :terms
+
+ def self.latest
+ order(:id).last
+ end
end
end