BigW Consortium Gitlab

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

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