Module: Alchemy::Page::PageScopes::ClassMethods

Defined in:
app/models/alchemy/page/page_scopes.rb

Instance Method Summary collapse

Instance Method Details

#not_publicObject

All not public pages


106
107
108
109
110
# File 'app/models/alchemy/page/page_scopes.rb', line 106

def not_public
  where("#{table_name}.public_on IS NULL OR " \
        "#{table_name}.public_on >= :time OR " \
        "#{table_name}.public_until <= :time", time: Time.current)
end

#publishedObject

All public pages


98
99
100
101
102
# File 'app/models/alchemy/page/page_scopes.rb', line 98

def published
  where("#{table_name}.public_on <= :time AND " \
        "(#{table_name}.public_until IS NULL " \
        "OR #{table_name}.public_until >= :time)", time: Time.current)
end