Read about our upcoming Code of Conduct on this issue

protected_branch.rb 650 Bytes
Newer Older
1
class ProtectedBranch < ActiveRecord::Base
2
3
  include GitHost

4
5
  attr_accessible :name

6
  belongs_to :project
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
7
8
  validates :name, presence: true
  validates :project, presence: true
9
10
11
12
13

  after_save :update_repository
  after_destroy :update_repository

  def update_repository
14
    git_host.update_repository(project)
15
16
17
18
19
20
  end

  def commit
    project.commit(self.name)
  end
end
Nihad Abbasov's avatar
Nihad Abbasov committed
21

22
23
24
25
# == Schema Information
#
# Table name: protected_branches
#
Nihad Abbasov's avatar
Nihad Abbasov committed
26
27
#  id         :integer         not null, primary key
#  project_id :integer         not null
28
29
30
31
#  name       :string(255)     not null
#  created_at :datetime        not null
#  updated_at :datetime        not null
#