Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kumanyaev <me@zzet.org>2012-10-09 04:10:04 +0400
committerAndrey Kumanyaev <me@zzet.org>2012-10-09 04:10:04 +0400
commitdf7c52489a890ac38491682b4a3399beb7cdbc86 (patch)
tree9a81bee70285ac1e5a0c158eab5f4c981e49b86d /app/models/group.rb
parenta635b9da97b0e104b8ac1a846344ec8a4abd3123 (diff)
simple refactoring
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 780d5fddca0..012b12856ec 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: groups
-#
-# id :integer not null, primary key
-# name :string(255) not null
-# code :string(255) not null
-# owner_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-
class Group < ActiveRecord::Base
attr_accessible :code, :name, :owner_id
@@ -18,7 +6,7 @@ class Group < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
validates :code, presence: true, uniqueness: true
- validates :owner_id, presence: true
+ validates :owner, presence: true
delegate :name, to: :owner, allow_nil: true, prefix: true
@@ -31,6 +19,18 @@ class Group < ActiveRecord::Base
end
def users
- User.joins(:users_projects).where('users_projects.project_id' => project_ids).uniq
+ User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
end
end
+
+# == Schema Information
+#
+# Table name: groups
+#
+# id :integer not null, primary key
+# name :string(255) not null
+# code :string(255) not null
+# owner_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+#