summaryrefslogtreecommitdiff
path: root/app/models/group.rb
diff options
context:
space:
mode:
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