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.
This commit is contained in:
@@ -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
|
||||
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
|
||||
@is_heading_content_block = true
|
||||
render :edit
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user