# == Schema Information
#
# Table name: project_actions
#
#  id          :integer          not null, primary key
#  project_id  :integer
#  type        :string(255)
#  user_id     :integer
#  event_extra :text(65535)
#  created_at  :datetime         not null
#  updated_at  :datetime         not null
#
# Indexes
#
#  index_project_actions_on_project_id  (project_id)
#


class ProjectActions::ForkEvent < ProjectAction
  def self.build(project, user, fork_project)
    project_action = new(project: project, user: user)
    project_action.event_extra = {
      forkee_id: fork_project.id,
      forkee_name: fork_project.identifier,
      forkee_owner_id: fork_project.owner.id,
      forkee_owner_login: fork_project.owner.login 
    }
    project_action.save!
  end
end
