diff options
author | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-09 01:17:38 -0700 |
---|---|---|
committer | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-09 01:17:38 -0700 |
commit | dc33f71b181d154c8d9937f777fa16e9cf1d968d (patch) | |
tree | 1424eedeeeb4a9016d0f6dc5a5986c17e74e9122 /app/models/group.rb | |
parent | c348284fedb487474626b3dae9be73311f8382df (diff) | |
parent | a4cd738686659314f0bb9fd13a80845dc2b036ab (diff) | |
download | gitlab-ce-dc33f71b181d154c8d9937f777fa16e9cf1d968d.tar.gz |
Merge pull request #1656 from zzet/refactoring
Refactoring
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 28 |
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 +# |