From b8b6515f935ffc9a27b7a735514dc39e8c092148 Mon Sep 17 00:00:00 2001 From: miks Date: Sat, 31 Dec 2011 19:37:14 +0200 Subject: [PATCH] Renamed project "keys" back to "deploy_keys" --- app/controllers/deploy_keys_controller.rb | 10 +++++----- app/models/project.rb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/deploy_keys_controller.rb b/app/controllers/deploy_keys_controller.rb index ca22e02b..7bbf6a3d 100644 --- a/app/controllers/deploy_keys_controller.rb +++ b/app/controllers/deploy_keys_controller.rb @@ -12,28 +12,28 @@ class DeployKeysController < ApplicationController end def index - @keys = @project.keys.all + @keys = @project.deploy_keys.all end def show - @key = @project.keys.find(params[:id]) + @key = @project.deploy_keys.find(params[:id]) end def new - @key = @project.keys.new + @key = @project.deploy_keys.new respond_with(@key) end def create - @key = @project.keys.new(params[:key]) + @key = @project.deploy_keys.new(params[:key]) @key.save respond_with(@key) end def destroy - @key = @project.keys.find(params[:id]) + @key = @project.deploy_keys.find(params[:id]) @key.destroy respond_to do |format| diff --git a/app/models/project.rb b/app/models/project.rb index 102efc45..51fb7cc3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -14,7 +14,7 @@ class Project < ActiveRecord::Base has_many :users, :through => :users_projects has_many :notes, :dependent => :destroy has_many :snippets, :dependent => :destroy - has_many :keys, :dependent => :destroy + has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key" has_many :web_hooks, :dependent => :destroy acts_as_taggable @@ -189,15 +189,15 @@ class Project < ActiveRecord::Base end def repository_readers - read_keys = Key.joins({:user => :users_projects}). + keys = Key.joins({:user => :users_projects}). where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_R) - read_keys.map(&:identifier) + keys.map(&:identifier) + keys.map(&:identifier) + deploy_keys.map(&:identifier) end def repository_writers - write_keys = Key.joins({:user => :users_projects}). + keys = Key.joins({:user => :users_projects}). where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_RW) - write_keys.map(&:identifier) + keys.map(&:identifier) end def readers