BigW Consortium Gitlab

deploy_key.rb 536 Bytes
Newer Older
Dmitriy Zaporozhets committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# == Schema Information
#
# Table name: keys
#
#  id         :integer          not null, primary key
#  user_id    :integer
#  created_at :datetime
#  updated_at :datetime
#  key        :text
#  title      :string(255)
#  identifier :string(255)
#  type       :string(255)
#

15 16 17
class DeployKey < Key
  has_many :deploy_keys_projects, dependent: :destroy
  has_many :projects, through: :deploy_keys_projects
18 19

  scope :in_projects, ->(projects) { joins(:deploy_keys_projects).where('deploy_keys_projects.project_id in (?)', projects) }
20
end