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

[6.1] Revert "Preload related objects in Alchemy::PagesController" #2473

Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ group :development, :test do
# in our case the culprit is `handlebars-assets`. The changes between 2.7.0 and 2.8.0 are
# minimal, but breaking.
gem "execjs", "= 2.8.1"
gem "selenium-webdriver", "< 4.9.1" # until https://github.com/teamcapybara/capybara/pull/2665 got merged

if ENV["GITHUB_ACTIONS"]
# Necessary because GH Actions gem cache does not have this "Bundled with Ruby" gem installed
Expand Down
24 changes: 5 additions & 19 deletions app/controllers/alchemy/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +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 ||= begin
Alchemy::Page.
contentpages.
language_roots.
where(language: Language.current).
includes(page_includes).
first
end
@page ||= Language.current_root_page
render template: "alchemy/welcome", layout: false if signup_required?
end

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

@page ||= begin
Alchemy::Page.
contentpages.
where(language: Language.current).
includes(page_includes).
find_by(urlname: params[:urlname])
end
@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 @@ -244,9 +234,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