Refactoring of hook functionality & bootsrap system hooks

This commit is contained in:
Valeriy Sizov 2012-07-12 15:36:33 +03:00
parent 72a571724d
commit 65dc68b35c
9 changed files with 24 additions and 14 deletions

View file

@ -19,7 +19,7 @@ class Project < ActiveRecord::Base
has_many :notes, :dependent => :destroy
has_many :snippets, :dependent => :destroy
has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key"
has_many :web_hooks, :dependent => :destroy
has_many :hooks, :dependent => :destroy, :class_name => "ProjectHook"
has_many :wikis, :dependent => :destroy
has_many :protected_branches, :dependent => :destroy

View file

@ -0,0 +1,3 @@
class ProjectHook < WebHook
belongs_to :project
end

View file

@ -0,0 +1,3 @@
class SystemHook < WebHook
end

View file

@ -4,8 +4,6 @@ class WebHook < ActiveRecord::Base
# HTTParty timeout
default_timeout 10
belongs_to :project
validates :url,
presence: true,
format: {