2012-02-15 20:02:33 +00:00
|
|
|
class ProtectedBranch < ActiveRecord::Base
|
2013-03-21 19:01:14 +00:00
|
|
|
include Gitlab::ShellAdapter
|
2017-04-03 14:17:24 +00:00
|
|
|
include ProtectedRef
|
2012-02-15 20:02:33 +00:00
|
|
|
|
2016-08-16 05:09:13 +00:00
|
|
|
has_many :merge_access_levels, dependent: :destroy
|
|
|
|
has_many :push_access_levels, dependent: :destroy
|
2016-07-05 07:40:42 +00:00
|
|
|
|
2017-02-22 00:40:04 +00:00
|
|
|
validates :merge_access_levels, length: { is: 1, message: "are restricted to a single instance per protected branch." }
|
|
|
|
validates :push_access_levels, length: { is: 1, message: "are restricted to a single instance per protected branch." }
|
2016-08-16 05:09:13 +00:00
|
|
|
|
|
|
|
accepts_nested_attributes_for :push_access_levels
|
|
|
|
accepts_nested_attributes_for :merge_access_levels
|
2012-02-15 20:02:33 +00:00
|
|
|
end
|