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'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inbox ⇒ Object
29 30 31 |
# File 'app/models/wco/tag.rb', line 29 def self.inbox find_or_create_by({ slug: INBOX }) end |
.list ⇒ Object
51 52 53 |
# File 'app/models/wco/tag.rb', line 51 def self.list [[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] } end |
.not_spam ⇒ Object
39 40 41 |
# File 'app/models/wco/tag.rb', line 39 def self.not_spam find_or_create_by({ slug: NOT_SPAM }) end |
.spam ⇒ Object
34 35 36 |
# File 'app/models/wco/tag.rb', line 34 def self.spam find_or_create_by({ slug: SPAM }) end |
.trash ⇒ Object
44 45 46 |
# File 'app/models/wco/tag.rb', line 44 def self.trash find_or_create_by({ slug: TRASH }) end |
Instance Method Details
#to_s ⇒ Object
48 49 50 |
# File 'app/models/wco/tag.rb', line 48 def to_s slug end |