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



110
111
112
113
114
# File 'app/models/alchemy/page/page_scopes.rb', line 110

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



102
103
104
105
106
# File 'app/models/alchemy/page/page_scopes.rb', line 102

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