Add functional in admin section

This commit is contained in:
Andrey Kumanyaev 2012-12-26 02:52:20 +04:00
parent 17ea019f4e
commit 9c574464a6
7 changed files with 106 additions and 19 deletions

View file

@ -82,6 +82,7 @@ class Project < ActiveRecord::Base
scope :public_only, where(private_flag: false)
scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) }
scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) }
scope :in_group, ->(group) { where(namespace_id: group.id) }
scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }
scope :personal, ->(user) { where(namespace_id: user.namespace_id) }
scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) }

View file

@ -33,6 +33,8 @@ class UsersProject < ActiveRecord::Base
delegate :name, :email, to: :user, prefix: true
scope :in_project, ->(project) { where(project_id: project.id) }
class << self
def import_team(source_project, target_project)
UsersProject.without_repository_callback do