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 "#{quoted_table_name}.published_at DESC" end |
#ordered_for_preview ⇒ Object
19 20 21 |
# File 'lib/almost_happy/scopeable.rb', line 19 def ordered_for_preview order "(#{quoted_table_name}.published_at IS NULL) DESC, #{quoted_table_name}.published_at DESC" end |
#published ⇒ Object
7 8 9 |
# File 'lib/almost_happy/scopeable.rb', line 7 def published where "#{quoted_table_name}.published_at IS NOT NULL AND #{quoted_table_name}.published_at <= ?", Time.now end |
#unpublished ⇒ Object
11 12 13 |
# File 'lib/almost_happy/scopeable.rb', line 11 def unpublished where "#{quoted_table_name}.published_at IS NULL OR #{quoted_table_name}.published_at > ?", Time.now end |