announcement_Setting fix
This commit is contained in:
parent
4ae6d34216
commit
0f168e366e
|
@ -5,7 +5,7 @@ class AnnouncementSetting
|
||||||
field :top_limit, type: Integer, :default => 0
|
field :top_limit, type: Integer, :default => 0
|
||||||
|
|
||||||
def self.check_limit_for_user(user_id, b_id = nil)
|
def self.check_limit_for_user(user_id, b_id = nil)
|
||||||
limit = self.first.top_limit
|
limit = self.first.top_limit rescue 0
|
||||||
return true if limit == 0
|
return true if limit == 0
|
||||||
count = Bulletin.where(:is_top => true, :create_user_id => user_id, :id.ne => b_id).count
|
count = Bulletin.where(:is_top => true, :create_user_id => user_id, :id.ne => b_id).count
|
||||||
return count < limit
|
return count < limit
|
||||||
|
|
Loading…
Reference in New Issue