This commit is contained in:
r888888888
2013-04-21 11:36:43 -07:00
parent 53c8babe3e
commit e2a38ebc17
11 changed files with 46 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
class Ban < ActiveRecord::Base
after_create :update_feedback
after_create :update_user_on_create
after_destroy :update_user_on_destroy
belongs_to :user
belongs_to :banner, :class_name => "User"
attr_accessible :reason, :duration, :user_id, :user_name
@@ -67,6 +69,14 @@ class Ban < ActiveRecord::Base
end
end
def update_user_on_create
user.update_attribute(:is_banned, true)
end
def update_user_on_destroy
user.update_attribute(:is_banned, false)
end
def user_name
user ? user.name : nil
end