From 1898bdec56c0ef782adcb103e803c48e40d7d2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 23 May 2024 19:45:29 +0200 Subject: [PATCH] Remove redundant conditions in content blocks controller In the case of the `edit` action, we're using `load_and_authorize_resource`, which will always return a `SiteCustomization::ContentBlock`. In the case of `edit_heading_content_block`, we're using `Budget::ContentBlock.find`, which always returns a `Budget::ContentBlock` (or raises an exception). So, in both cases, the condition to assign `@selected_content_block` can be removed. --- .../site_customization/content_blocks_controller.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/controllers/admin/site_customization/content_blocks_controller.rb b/app/controllers/admin/site_customization/content_blocks_controller.rb index 9334ee656..d4a01c01b 100644 --- a/app/controllers/admin/site_customization/content_blocks_controller.rb +++ b/app/controllers/admin/site_customization/content_blocks_controller.rb @@ -34,11 +34,7 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati end def edit - if @content_block.is_a? SiteCustomization::ContentBlock - @selected_content_block = @content_block.name - else - @selected_content_block = "hcb_#{@content_block.heading_id}" - end + @selected_content_block = @content_block.name end def update @@ -75,11 +71,7 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati def edit_heading_content_block @content_block = Budget::ContentBlock.find(params[:id]) - if @content_block.is_a? Budget::ContentBlock - @selected_content_block = "hcb_#{@content_block.heading_id}" - else - @selected_content_block = @content_block.name - end + @selected_content_block = "hcb_#{@content_block.heading_id}" @is_heading_content_block = true render :edit end