Method: Pageflow::Configuration#public_entry_request_scope

Defined in:
lib/pageflow/configuration.rb

#public_entry_request_scopeObject

Either a lambda or an object with a call method taking two parameters: An ActiveRecord scope of Pageflow::Entry records and an ActionDispatch::Request object. Has to return the scope in which to find entries.

Used by all public actions that display entries to restrict the available entries by hostname or other request attributes.

Use #public_entry_url_options to make sure urls of published entries conform twith the restrictions.

Example:

# Only make entries of one account available under <account.name>.example.com
config.public_entry_request_scope = lambda do |entries, request|
  entries.includes(:account).where(pageflow_accounts: {name: request.subdomain})
end


156
157
158
# File 'lib/pageflow/configuration.rb', line 156

def public_entry_request_scope
  @public_entry_request_scope
end