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:
authorValeriy Sizov <vsv2711@gmail.com>2012-10-09 12:17:38 +0400
committerValeriy Sizov <vsv2711@gmail.com>2012-10-09 12:17:38 +0400
commitdc33f71b181d154c8d9937f777fa16e9cf1d968d (patch)
tree1424eedeeeb4a9016d0f6dc5a5986c17e74e9122 /app/models/group.rb
parentc348284fedb487474626b3dae9be73311f8382df (diff)
parenta4cd738686659314f0bb9fd13a80845dc2b036ab (diff)
Merge pull request #1656 from zzet/refactoring
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
+#