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

34 lines
752 B
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
# == Schema Information
#
2015-11-26 14:37:03 +05:30
# Table name: ci_application_settings
2015-09-25 12:07:36 +05:30
#
# 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
2015-11-26 14:37:03 +05:30
after_commit do
Rails.cache.write('ci_application_setting.last', self)
end
2015-09-25 12:07:36 +05:30
def self.current
2015-11-26 14:37:03 +05:30
Rails.cache.fetch('ci_application_setting.last') do
Ci::ApplicationSetting.last
end
2015-09-25 12:07:36 +05:30
end
def self.create_from_defaults
create(
all_broken_builds: Settings.gitlab_ci['all_broken_builds'],
add_pusher: Settings.gitlab_ci['add_pusher'],
)
end
end
end