Fixed and refactored foodcoop/workgroups.

This commit is contained in:
benni 2011-05-16 00:34:43 +02:00
parent c87ead8da9
commit 06f2cc2007
6 changed files with 54 additions and 23 deletions

View file

@ -9,6 +9,8 @@ class Group < ActiveRecord::Base
validate :last_admin_on_earth, :on => :update
before_destroy :check_last_admin_group
attr_reader :user_tokens
# Returns true if the given user if is an member of this group.
def member?(user)
@ -20,6 +22,10 @@ class Group < ActiveRecord::Base
User.all(:order => 'nick').reject { |u| users.include?(u) }
end
def user_tokens=(ids)
self.user_ids = ids.split(",")
end
protected
# Check before destroy a group, if this is the last group with admin role