Class: Wco::Tag
- Inherits:
-
Object
- Object
- Wco::Tag
- Includes:
- Mongoid::Document, Mongoid::Paranoia, Mongoid::Timestamps
- Defined in:
- app/models/wco/tag.rb
Constant Summary collapse
- INBOX =
'inbox'- SPAM =
'spam'- NOT_SPAM =
'not-spam'- TRASH =
'trash'- DONOTSEND =
'donotsend'
Class Method Summary collapse
- .donotsend ⇒ Object
- .inbox ⇒ Object
- .list ⇒ Object
- .not_spam ⇒ Object
- .spam ⇒ Object
- .trash ⇒ Object
Instance Method Summary collapse
Class Method Details
.donotsend ⇒ Object
56 57 58 |
# File 'app/models/wco/tag.rb', line 56 def self.donotsend find_or_create_by({ slug: DONOTSEND }) end |
.inbox ⇒ Object
36 37 38 |
# File 'app/models/wco/tag.rb', line 36 def self.inbox find_or_create_by({ slug: INBOX }) end |
.list ⇒ Object
63 64 65 |
# File 'app/models/wco/tag.rb', line 63 def self.list [[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] } end |
.not_spam ⇒ Object
46 47 48 |
# File 'app/models/wco/tag.rb', line 46 def self.not_spam find_or_create_by({ slug: NOT_SPAM }) end |
.spam ⇒ Object
41 42 43 |
# File 'app/models/wco/tag.rb', line 41 def self.spam find_or_create_by({ slug: SPAM }) end |
.trash ⇒ Object
51 52 53 |
# File 'app/models/wco/tag.rb', line 51 def self.trash find_or_create_by({ slug: TRASH }) end |
Instance Method Details
#to_s ⇒ Object
60 61 62 |
# File 'app/models/wco/tag.rb', line 60 def to_s slug end |