Rename scope "in_group" to "in_namespace"

This commit is contained in:
Andrey Kumanyaev 2012-12-26 14:22:12 +04:00
parent 1e3d238910
commit 634783feb0
2 changed files with 2 additions and 2 deletions

View file

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

View file

@ -76,7 +76,7 @@
%tr{class: "user_#{u.id}"} %tr{class: "user_#{u.id}"}
%td.name= link_to u.name, admin_user_path(u) %td.name= link_to u.name, admin_user_path(u)
%td.projects_access %td.projects_access
- u.projects.in_group(@group).each do |project| - u.projects.in_namespace(@group).each do |project|
- u_p = u.users_projects.in_project(project).first - u_p = u.users_projects.in_project(project).first
= "#{project.name} (#{link_to u_p.project_access_human, edit_admin_team_member_path(u_p) })".html_safe = "#{project.name} (#{link_to u_p.project_access_human, edit_admin_team_member_path(u_p) })".html_safe
%tr %tr