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:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-10-02 19:17:12 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-10-02 19:17:12 +0400
commitfa3ae24ca7a11f3d87c8838cf05a95dfecfa4c5c (patch)
tree27288e6e981dd79e46904a6c0942cc1d0d9721e0 /app/models/group.rb
parent2e1c3c52bc43d08bc01cf3ba5fba377b3236223b (diff)
Group entity. Group has many projects
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
new file mode 100644
index 00000000000..f18b7d57650
--- /dev/null
+++ b/app/models/group.rb
@@ -0,0 +1,22 @@
+# == 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
+
+ has_many :projects
+ belongs_to :owner, class_name: "User"
+
+ validates :name, presence: true, uniqueness: true
+ validates :code, presence: true, uniqueness: true
+ validates :owner_id, presence: true
+end