Module: AlmostHappy::Scopeable::ClassMethods
- Defined in:
- lib/almost_happy/scopeable.rb
Instance Method Summary collapse
Instance Method Details
#ordered ⇒ Object
15 16 17 |
# File 'lib/almost_happy/scopeable.rb', line 15 def ordered order 'published_at DESC' end |
#ordered_for_preview ⇒ Object
19 20 21 |
# File 'lib/almost_happy/scopeable.rb', line 19 def ordered_for_preview order '(published_at IS NULL) DESC, published_at DESC' end |
#published ⇒ Object
7 8 9 |
# File 'lib/almost_happy/scopeable.rb', line 7 def published where 'published_at IS NOT NULL AND published_at <= ?', Time.now end |
#unpublished ⇒ Object
11 12 13 |
# File 'lib/almost_happy/scopeable.rb', line 11 def unpublished where 'published_at IS NULL OR published_at > ?', Time.now end |