You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
574 B
14 lines
574 B
6 years ago
|
class Commit < ActiveRecord::Base
|
||
|
attr_accessible :comments, :committed_on, :committer, :project_id, :repository_id, :version
|
||
|
validates :repository_id, presence: true
|
||
|
validates :version, presence: true, uniqueness: {scope: :repository_id}
|
||
|
validates :committed_on, presence: true
|
||
|
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||
|
after_create :act_as_forge_activity
|
||
|
|
||
|
# 项目中提交动态
|
||
|
def act_as_forge_activity
|
||
|
self.forge_acts << ForgeActivity.new(:user_id => 2, :project_id => self.project_id)
|
||
|
end
|
||
|
end
|