Files
nairobi/app/controllers/pages_controller.rb
Javi Martín b2c8fee059 Ignore dots in slugs when rendering custom pages
We were getting a warning in one of the tests:

DEPRECATION WARNING: Rendering actions with '.' in the name is
deprecated: application/nonExistentJavaScript.js

I haven't found a case where the behavior on production environments is
different due to this change; the application seems to behave the same
way as it used to. So I'm not adding tests for this change.
2023-09-11 23:40:37 +02:00

20 lines
518 B
Ruby

class PagesController < ApplicationController
include FeatureFlags
skip_authorization_check
feature_flag :help_page, if: lambda { params[:id] == "help/index" }
def show
@custom_page = SiteCustomization::Page.published.find_by(slug: params[:id])
if @custom_page.present?
@cards = @custom_page.cards
render action: :custom_page
else
render action: params[:id].split(".").first
end
rescue ActionView::MissingTemplate
head :not_found, content_type: "text/html"
end
end