Fixed and refactored foodcoop/workgroups.
This commit is contained in:
parent
c87ead8da9
commit
06f2cc2007
6 changed files with 54 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue