BigW Consortium Gitlab

application_setting.rb 752 Bytes
Newer Older
1 2
# == Schema Information
#
Dmitriy Zaporozhets committed
3
# Table name: ci_application_settings
4 5 6 7 8 9 10 11 12 13 14
#
#  id                :integer          not null, primary key
#  all_broken_builds :boolean
#  add_pusher        :boolean
#  created_at        :datetime
#  updated_at        :datetime
#

module Ci
  class ApplicationSetting < ActiveRecord::Base
    extend Ci::Model
15 16 17 18 19

    after_commit do
      Rails.cache.write('ci_application_setting.last', self)
    end

20
    def self.current
21 22 23
      Rails.cache.fetch('ci_application_setting.last') do
        Ci::ApplicationSetting.last
      end
24 25 26 27
    end

    def self.create_from_defaults
      create(
Valery Sizov committed
28 29
        all_broken_builds: Settings.gitlab_ci['all_broken_builds'],
        add_pusher: Settings.gitlab_ci['add_pusher'],
30 31 32 33
      )
    end
  end
end