Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Preload related objects in Alchemy::PagesController" #2472

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions app/controllers/alchemy/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,7 @@ def locale_prefix_not_allowed?
# If no index page and no admin users are present we show the "Welcome to Alchemy" page.
#
def load_index_page
@page ||= Alchemy::Page
.contentpages
.language_roots
.where(language: Language.current)
.includes(page_includes)
.first

@page ||= Language.current_root_page
render template: "alchemy/welcome", layout: false if signup_required?
end

Expand All @@ -126,11 +120,10 @@ def load_index_page
def load_page
page_not_found! unless Language.current

@page ||= Alchemy::Page
.contentpages
.where(language: Language.current)
.includes(page_includes)
.find_by(urlname: params[:urlname])
@page ||= Language.current.pages.contentpages.find_by(
urlname: params[:urlname],
language_code: params[:locale] || Language.current.code
)
end

def enforce_locale
Expand Down Expand Up @@ -235,9 +228,5 @@ def must_not_cache?
def page_not_found!
not_found_error!("Alchemy::Page not found \"#{request.fullpath}\"")
end

def page_includes
Alchemy::EagerLoading.page_includes(version: :public_version)
end
end
end