Files
nairobi/app/controllers/pages_controller.rb
Javi Martín 2bfa9068f1 Add and apply Rails/HttpStatus rubocop rule
We were already using it in most places. Since rubocop-rails 2.11.0,
this rule also detects offenses when using the `head` method, which we
were using with a plain `404`.
2021-09-03 11:49:52 +02:00

20 lines
501 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]
end
rescue ActionView::MissingTemplate
head :not_found, content_type: "text/html"
end
end