diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:05:14 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:05:14 +0100 |
commit | eaad37485fe59d0306c37cc038dda6d210052910 (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /app/models/user_group.rb | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) | |
parent | b80bd744ad873f6fc43018bc4bfb90677de167bd (diff) |
Merge branch 'develop'
Diffstat (limited to 'app/models/user_group.rb')
-rw-r--r-- | app/models/user_group.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/models/user_group.rb b/app/models/user_group.rb new file mode 100644 index 0000000..44f2fd8 --- /dev/null +++ b/app/models/user_group.rb @@ -0,0 +1,33 @@ +class UserGroup < ActiveRecord::Base + attr_accessible :name, :description + + belongs_to :tenant + + validates_presence_of :name + validates_uniqueness_of :name, :scope => :tenant_id + + validates_presence_of :tenant + + validates_length_of :name, :within => 1..50 + + has_many :user_group_memberships, :dependent => :destroy, :uniq => true + has_many :users, :through => :user_group_memberships + + has_many :gui_function_memberships, :dependent => :destroy + has_many :gui_functions, :through => :gui_function_memberships + + has_many :phone_books, :as => :phone_bookable, :dependent => :destroy + has_many :phone_book_entries, :through => :phone_books + + has_many :sip_accounts, :as => :sip_accountable, :dependent => :destroy + + has_many :conferences, :as => :conferenceable, :dependent => :destroy + + has_many :fax_accounts, :as => :fax_accountable, :dependent => :destroy + + acts_as_list :scope => :tenant_id + + def to_s + name + end +end |