Don't error when deleting supplier/group with already existing deleted name (closes foodcoops/foodsoft#197)

This commit is contained in:
wvengen 2015-04-17 20:05:46 +02:00
parent b028431bf0
commit 17cbc57850
3 changed files with 33 additions and 3 deletions

View file

@ -1,6 +1,9 @@
# encoding: utf-8
# Groups organize the User.
# A Member gets the roles from the Group
class Group < ActiveRecord::Base
include MarkAsDeletedWithName
has_many :memberships, dependent: :destroy
has_many :users, :through => :memberships
@ -32,8 +35,8 @@ class Group < ActiveRecord::Base
# TODO: Checks for participating in not closed orders
transaction do
memberships.destroy_all
# TODO: What should happen to users?
update_column :deleted_at, Time.now
# @todo what should happen to the users?
super
end
end
end