User deletion

This commit is contained in:
Gopesh Tulsyan 2014-08-10 11:41:35 +05:30
parent a2b8806e35
commit 6890802a78
8 changed files with 60 additions and 9 deletions

View file

@ -122,6 +122,21 @@ class User < ActiveRecord::Base
end
end
def destroy
if self.events.blank?
super
else
self.events.each do |event|
if event.start_time.nil? || event.start_time > DateTime.now
event.destroy
else
EventUser.create_deleted_eventuser(self,event)
end
end
super
end
end
private
def biography_limit