Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#63386] Use rescue_from ActiveRecord::RecordNotFound

Dombi Attila10dc5538a2af
diff --git a/app/controllers/admin/attachments/quarantined_attachments_controller.rb b/app/controllers/admin/attachments/quarantined_attachments_controller.rb
index 80b7ec2556f..3b28ca495d5 100644
--- a/app/controllers/admin/attachments/quarantined_attachments_controller.rb
+++ b/app/controllers/admin/attachments/quarantined_attachments_controller.rb
@@ -73,8 +73,6 @@ module Admin
def find_attachment
@attachment = @attachments.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
index a23eda79907..ed67330f040 100644
--- a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
+++ b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
@@ -146,8 +146,6 @@ module Admin
def find_model_object
@object = CustomField.hierarchy_root_and_children.find(params[:custom_field_id])
@custom_field = @object
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_active_item
@@ -156,8 +154,6 @@ module Admin
else
@object.hierarchy_root
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rb
index 39b328304bd..8a53a428268 100644
--- a/app/controllers/admin/settings/project_custom_fields_controller.rb
+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb
@@ -212,8 +212,6 @@ module Admin::Settings
def find_custom_field
@custom_field = ProjectCustomField.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def drop_success_streams(call)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 657e26c1116..bd5793ae38c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -133,6 +133,10 @@ class ApplicationController < ActionController::Base
payload: ::OpenProject::Logging::ThreadPoolContextBuilder.build!
end
+ rescue_from ActiveRecord::RecordNotFound do
+ render_404
+ end
+
before_action :authorization_check_required,
:user_setup,
:set_localization,
@@ -240,16 +244,12 @@ class ApplicationController < ActionController::Base
# Note: find() is Project.friendly.find()
def find_project
@project = Project.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
# Find project of id params[:project_id]
# Note: find() is Project.friendly.find()
def find_project_by_project_id
@project = Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
# Finds and sets @project based on @object.project
@@ -257,8 +257,6 @@ class ApplicationController < ActionController::Base
render_404 if @object.blank?
@project = @object.project
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_model_object(object_id = :id)
@@ -267,8 +265,6 @@ class ApplicationController < ActionController::Base
@object = model.find(params[object_id])
instance_variable_set(:"@#{controller_name.singularize}", @object) if @object
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_model_object_and_project(object_id = :id)
@@ -280,8 +276,6 @@ class ApplicationController < ActionController::Base
else
@project = Project.find(params[:project_id])
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
# TODO: this method is right now only suited for controllers of objects that somehow have an association to Project
@@ -295,8 +289,6 @@ class ApplicationController < ActionController::Base
associated.each do |a|
instance_variable_set("@" + a.class.to_s.downcase, a)
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
# this method finds all records that are specified in the associations param
@@ -337,8 +329,6 @@ class ApplicationController < ActionController::Base
@projects = @work_packages.filter_map(&:project).uniq
@project = @projects.first if @projects.size == 1
- rescue ActiveRecord::RecordNotFound
- render_404
end
def back_url
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index 062a2733782..1d42804a5a1 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -109,8 +109,6 @@ class AttributeHelpTextsController < ApplicationController
def find_entry
@attribute_help_text = AttributeHelpText.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_type_scope
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index 286f766e469..feb3c809d20 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -101,7 +101,5 @@ class CategoriesController < ApplicationController
def find_project
@project = Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
diff --git a/app/controllers/concerns/accounts/authorization.rb b/app/controllers/concerns/accounts/authorization.rb
index 93320f71eb1..7bb34d46159 100644
--- a/app/controllers/concerns/accounts/authorization.rb
+++ b/app/controllers/concerns/accounts/authorization.rb
@@ -76,8 +76,6 @@ module Accounts::Authorization
@project = Project.find(params[:project_id]) if params[:project_id].present?
do_authorize({ controller: controller_path, action: action_name }, global: params[:project_id].blank?)
- rescue ActiveRecord::RecordNotFound
- render_404
end
# Deny access if user is not allowed to do the specified action.
@@ -214,8 +212,6 @@ module Accounts::Authorization
before_action(**args) do
@project = Project.find(params[:project_id]) if params[:project_id].present?
do_authorize(permission, global: params[:project_id].blank?)
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/app/controllers/concerns/custom_fields/shared_actions.rb b/app/controllers/concerns/custom_fields/shared_actions.rb
index 3fab2fca572..0c1b9553772 100644
--- a/app/controllers/concerns/custom_fields/shared_actions.rb
+++ b/app/controllers/concerns/custom_fields/shared_actions.rb
@@ -125,8 +125,6 @@ module CustomFields
def find_custom_option
@custom_option = CustomOption.find params[:option_id]
- rescue ActiveRecord::RecordNotFound
- render_404
end
def delete_custom_values!(custom_option)
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index c280ec2dfeb..3bf72aedf15 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -75,8 +75,6 @@ class CustomFieldsController < ApplicationController
def find_custom_field
@custom_field = CustomField.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def check_custom_field
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 414248f8161..b4d7c3ba3aa 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -125,8 +125,6 @@ class ForumsController < ApplicationController
def find_forum
@forum = @project.forums.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def new_forum
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index e1b49530e78..0e3ce394057 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -59,8 +59,6 @@ class JournalsController < ApplicationController
journals: @journals }
end
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def diff
@@ -87,8 +85,6 @@ class JournalsController < ApplicationController
@journal = Journal.find(params[:id])
@journable = @journal.journable
@project = @journable.project
- rescue ActiveRecord::RecordNotFound
- render_404
end
def ensure_permitted
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 4e851f18bb9..8fd8bba3a53 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -118,13 +118,9 @@ class NewsController < ApplicationController
def find_news_object
@news = @object = News.find(params[:id].to_i)
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_project
@project = Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index 04686f9e908..2964cca876d 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -115,8 +115,6 @@ module OAuth
def find_app
@application = ::Doorkeeper::Application.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/app/controllers/placeholder_users/memberships_controller.rb b/app/controllers/placeholder_users/memberships_controller.rb
index 7b164709921..35bb55a1c08 100644
--- a/app/controllers/placeholder_users/memberships_controller.rb
+++ b/app/controllers/placeholder_users/memberships_controller.rb
@@ -35,8 +35,6 @@ class PlaceholderUsers::MembershipsController < ApplicationController
def find_individual_principal
@individual_principal = PlaceholderUser.find(params[:placeholder_user_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def redirected_to_tab(_membership)
diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb
index 65ce10e47e4..e1317bde96b 100644
--- a/app/controllers/placeholder_users_controller.rb
+++ b/app/controllers/placeholder_users_controller.rb
@@ -146,8 +146,6 @@ class PlaceholderUsersController < ApplicationController
def find_placeholder_user
@placeholder_user = PlaceholderUser.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
protected
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 37682ac30da..cff4751c01b 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -320,8 +320,6 @@ class RepositoriesController < ApplicationController
end
rescue OpenProject::SCM::Exceptions::SCMEmpty
render "empty"
- rescue ActiveRecord::RecordNotFound
- render_404
rescue InvalidRevisionParam
show_error_not_found
end
diff --git a/app/controllers/users/memberships_controller.rb b/app/controllers/users/memberships_controller.rb
index 681163c3474..2daf11b1f9a 100644
--- a/app/controllers/users/memberships_controller.rb
+++ b/app/controllers/users/memberships_controller.rb
@@ -35,8 +35,6 @@ class Users::MembershipsController < ApplicationController
def find_individual_principal
@individual_principal = User.find(params[:user_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def redirected_to_tab(membership)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index c257e1949e4..3a0b2e866ef 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -244,8 +244,6 @@ class UsersController < ApplicationController
else
@user = User.find(params[:id])
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def authorize_for_user
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 15d5ea200f5..2c2a189a32d 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -136,8 +136,6 @@ class VersionsController < ApplicationController
def find_project
@project = Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def retrieve_selected_type_ids(selectable_types, default_types = nil)
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index f3c8853a944..a9824dca7fd 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -367,8 +367,6 @@ class WikiController < ApplicationController
@project = Project.find(params[:project_id])
@wiki = @project.wiki
render_404 unless @wiki
- rescue ActiveRecord::RecordNotFound
- render_404
end
# Finds or created the wiki page associated
diff --git a/app/controllers/work_package_relations_tab_controller.rb b/app/controllers/work_package_relations_tab_controller.rb
index 097b4b8296e..a1ce2acaa11 100644
--- a/app/controllers/work_package_relations_tab_controller.rb
+++ b/app/controllers/work_package_relations_tab_controller.rb
@@ -51,7 +51,5 @@ class WorkPackageRelationsTabController < ApplicationController
def set_work_package
@work_package = WorkPackage.find(params[:work_package_id])
@project = @work_package.project # required for authorization via before_action
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
diff --git a/app/helpers/work_packages_controller_helper.rb b/app/helpers/work_packages_controller_helper.rb
index 6e1ae6e7803..e70718cdb66 100644
--- a/app/helpers/work_packages_controller_helper.rb
+++ b/app/helpers/work_packages_controller_helper.rb
@@ -61,8 +61,6 @@ module WorkPackagesControllerHelper
request.format = "html"
render_400(message: @query.errors.full_messages.join(". "))
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def atom_list
diff --git a/lib/individual_principals/membership_controller_methods.rb b/lib/individual_principals/membership_controller_methods.rb
index 363214626d5..e42ff8d7a67 100644
--- a/lib/individual_principals/membership_controller_methods.rb
+++ b/lib/individual_principals/membership_controller_methods.rb
@@ -35,8 +35,6 @@ module IndividualPrincipals
def find_membership
@membership = Member.visible(current_user).find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def respond_with_service_call(call, message:)
diff --git a/modules/auth_saml/app/controllers/saml/providers_controller.rb b/modules/auth_saml/app/controllers/saml/providers_controller.rb
index f0cfb72c966..6d10e816a99 100644
--- a/modules/auth_saml/app/controllers/saml/providers_controller.rb
+++ b/modules/auth_saml/app/controllers/saml/providers_controller.rb
@@ -180,8 +180,6 @@ module Saml
def find_provider
@provider = Saml::Provider.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def check_provider_writable
diff --git a/modules/avatars/app/controllers/avatars/users_controller.rb b/modules/avatars/app/controllers/avatars/users_controller.rb
index d4846468fc9..47355f881e2 100644
--- a/modules/avatars/app/controllers/avatars/users_controller.rb
+++ b/modules/avatars/app/controllers/avatars/users_controller.rb
@@ -17,8 +17,6 @@ module ::Avatars
def find_user
@user = User.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rb
index f820b9b9fd8..21b263e90ea 100644
--- a/modules/budgets/app/controllers/budgets_controller.rb
+++ b/modules/budgets/app/controllers/budgets_controller.rb
@@ -199,8 +199,6 @@ class BudgetsController < ApplicationController
# This function comes directly from issues_controller.rb (Redmine 0.8.4)
@budget = Budget.includes(:project, :author).find_by(id: params[:id])
@project = @budget.project if @budget
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_budgets
@@ -216,14 +214,10 @@ class BudgetsController < ApplicationController
# TODO: let users bulk edit/move/destroy budgets from different projects
render_error "Can not bulk edit/move/destroy cost objects from different projects" and return false
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_optional_project
@project = Project.find(params[:project_id]) if params[:project_id].present?
- rescue ActiveRecord::RecordNotFound
- render_404
end
def render_item_as_json(element_id, costs, unit, project, permission)
diff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rb
index 373cb2bec67..4d34662cece 100644
--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb
+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb
@@ -106,8 +106,6 @@ module ::Calendar
@view = Query
.visible(current_user)
.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
end
diff --git a/modules/calendar/app/controllers/calendar/ical_controller.rb b/modules/calendar/app/controllers/calendar/ical_controller.rb
index 2ebf12661bd..a250c2d01cd 100644
--- a/modules/calendar/app/controllers/calendar/ical_controller.rb
+++ b/modules/calendar/app/controllers/calendar/ical_controller.rb
@@ -33,15 +33,10 @@ module ::Calendar
no_authorization_required! :show
def show
- begin
- call = ::Calendar::ICalResponseService.new.call(
- ical_token_string: params[:ical_token],
- query_id: params[:id]
- )
- rescue ActiveRecord::RecordNotFound
- render_404
- return
- end
+ call = ::Calendar::ICalResponseService.new.call(
+ ical_token_string: params[:ical_token],
+ query_id: params[:id]
+ )
if call.present? && call.success?
send_data call.result, filename: "openproject_calendar_#{DateTime.now.to_i}.ics"
diff --git a/modules/costs/app/controllers/admin/cost_types_controller.rb b/modules/costs/app/controllers/admin/cost_types_controller.rb
index 0cb40984649..cc6cf118847 100644
--- a/modules/costs/app/controllers/admin/cost_types_controller.rb
+++ b/modules/costs/app/controllers/admin/cost_types_controller.rb
@@ -151,8 +151,6 @@ module Admin
def find_cost_type
@cost_type = CostType.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def show_local_breadcrumb
diff --git a/modules/costs/app/controllers/costlog_controller.rb b/modules/costs/app/controllers/costlog_controller.rb
index b1811eb2420..531664914d3 100644
--- a/modules/costs/app/controllers/costlog_controller.rb
+++ b/modules/costs/app/controllers/costlog_controller.rb
@@ -110,8 +110,6 @@ class CostlogController < ApplicationController
render_404
false
end
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_associated_objects
diff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rb
index 0b46db90a00..ae75c8a5f40 100644
--- a/modules/costs/app/controllers/hourly_rates_controller.rb
+++ b/modules/costs/app/controllers/hourly_rates_controller.rb
@@ -172,19 +172,13 @@ class HourlyRatesController < ApplicationController
def find_project
@project = Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_optional_project
@project = params[:project_id].blank? ? nil : Project.find(params[:project_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_user
@user = params[:id] ? User.find(params[:id]) : User.current
- rescue ActiveRecord::RecordNotFound
- render_404
end
end
diff --git a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb
index 2b6882dac60..3df60f92b0a 100644
--- a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb
+++ b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_filters_controller.rb
@@ -73,8 +73,6 @@ module LdapGroups
def find_filter
@filter = SynchronizedFilter.find(params[:ldap_filter_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def check_ee
diff --git a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb
index ec7dd07cb07..21431035e27 100644
--- a/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb
+++ b/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb
@@ -52,8 +52,6 @@ module LdapGroups
def find_group
@group = SynchronizedGroup.find(params[:ldap_group_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def check_ee
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 68487cbe237..7e42f08ddfa 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -439,8 +439,6 @@ class MeetingsController < ApplicationController
@meeting = Meeting
.includes([:project, :author, { participants: :user }, :sections, { agenda_items: :outcomes }])
.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def convert_params # rubocop:disable Metrics/AbcSize
@@ -516,8 +514,6 @@ class MeetingsController < ApplicationController
return unless copied_from_meeting_id
@copy_from = Meeting.visible.find(copied_from_meeting_id)
- rescue ActiveRecord::RecordNotFound
- render_404
end
def copy_attributes
diff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rb
index a7cbf82bd7d..95250b2a041 100644
--- a/modules/meeting/app/controllers/recurring_meetings_controller.rb
+++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb
@@ -310,14 +310,10 @@ class RecurringMeetingsController < ApplicationController
def find_optional_project
@project = Project.find(params[:project_id]) if params[:project_id].present?
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_meeting
@recurring_meeting = RecurringMeeting.visible.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def convert_params
@@ -341,8 +337,6 @@ class RecurringMeetingsController < ApplicationController
return unless copied_from_meeting_id
@copy_from = Meeting.visible.find(copied_from_meeting_id)
- rescue ActiveRecord::RecordNotFound
- render_404
end
def structured_meeting_params
diff --git a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
index bb92d783f02..85f127b415d 100644
--- a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
+++ b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
@@ -101,8 +101,6 @@ class WorkPackageMeetingsTabController < ApplicationController
def set_work_package
@work_package = WorkPackage.find(params[:work_package_id])
@project = @work_package.project # required for authorization via before_action
- rescue ActiveRecord::RecordNotFound
- render_404
end
def add_work_package_to_meeting_params
diff --git a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb
index 074b04917e0..88d6c36c5f8 100644
--- a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb
+++ b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb
@@ -128,8 +128,6 @@ module OpenIDConnect
def find_provider
@provider = OpenIDConnect::Provider.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def default_breadcrumb; end
diff --git a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb
index 6b04456e264..fb39836b507 100644
--- a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb
+++ b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb
@@ -82,8 +82,6 @@ module ::TeamPlanner
@view = Query
.visible(current_user)
.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def visible_plans(project = nil)
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
index d224bbbde88..56d03f16700 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
@@ -99,8 +99,6 @@ module ::TwoFactorAuthentication
# Get the used device for verification
def otp_service_for_verification(user)
otp_service(user, use_device: remembered_device(user))
- rescue ActiveRecord::RecordNotFound
- render_404
false
end
@@ -120,8 +118,6 @@ module ::TwoFactorAuthentication
end
otp_service(@authenticated_user, use_channel: channel, use_device: device)
- rescue ActiveRecord::RecordNotFound
- render_404
false
end
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
index 194ac410309..8f0b56ed9ce 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
@@ -229,8 +229,6 @@ module ::TwoFactorAuthentication
def find_device
@device = target_user.otp_devices.find(params[:device_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_user
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
index 2f0d521ad25..f839e48c522 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
@@ -105,8 +105,6 @@ module ::TwoFactorAuthentication
def find_user
@user = User.find(params[:id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def target_user
diff --git a/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb b/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb
index 688c61eae9a..95bdb27ebd4 100644
--- a/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb
+++ b/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb
@@ -58,8 +58,6 @@ module Webhooks
def find_webhook
@webhook = webhook_class.find(params[:webhook_id])
- rescue ActiveRecord::RecordNotFound
- render_404
end
def webhook_class