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

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

Instance Method Summary collapse

Instance Method Details

#not_public(time = Time.current) ⇒ Object

All pages that do not have any public version



112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'app/models/alchemy/page/page_scopes.rb', line 112

def not_public(time = Time.current)
  where <<~SQL
    alchemy_pages.id NOT IN (
      SELECT alchemy_page_versions.page_id
      FROM alchemy_page_versions
      WHERE alchemy_page_versions.public_on <= '#{connection.quoted_date(time)}'
      AND (
        alchemy_page_versions.public_until IS NULL
        OR alchemy_page_versions.public_until >= '#{connection.quoted_date(time)}'
      )
    )
  SQL
end

#ransackable_scopes(_auth_object) ⇒ Object



126
127
128
# File 'app/models/alchemy/page/page_scopes.rb', line 126

def ransackable_scopes(_auth_object)
  [:published, :from_current_site, :searchables, :layoutpages]
end