Class: Notice

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/notice.rb

Constant Summary collapse

TYPES =
%w{message warning}

Instance Method Summary collapse

Instance Method Details

#destroy_noticeObject


15
16
17
18
19
20
21
22
# File 'app/models/notice.rb', line 15

def destroy_notice
  if global
    destroy
  else
    users.delete(User.current)
    destroy unless users.any?
  end
end

#to_sObject


11
12
13
# File 'app/models/notice.rb', line 11

def to_s
  "#{global? ? "global" : "individual"} #{content}"
end