diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2012-10-02 19:17:12 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2012-10-02 19:17:12 +0400 |
commit | fa3ae24ca7a11f3d87c8838cf05a95dfecfa4c5c (patch) | |
tree | 27288e6e981dd79e46904a6c0942cc1d0d9721e0 /app/models/group.rb | |
parent | 2e1c3c52bc43d08bc01cf3ba5fba377b3236223b (diff) |
Group entity. Group has many projects
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 22 |
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 |