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

use error_messages_for method now

ulferts60ed64cd0460
diff --git a/app/controllers/custom_actions_controller.rb b/app/controllers/custom_actions_controller.rb
index c42aaab2f2d..f85c3606a1d 100644
--- a/app/controllers/custom_actions_controller.rb
+++ b/app/controllers/custom_actions_controller.rb
@@ -77,7 +77,6 @@ class CustomActionsController < ApplicationController
call.on_failure do
@custom_action = call.result
- @errors = call.errors
render action: render_action
end
}
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index d1412c242b6..8634e898082 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -57,7 +57,6 @@ module OAuth
flash[:_application_secret] = call.result.plaintext_secret
redirect_to action: :show, id: call.result.id
else
- @errors = call.errors
render action: :new
end
end
@@ -70,7 +69,6 @@ module OAuth
flash[:notice] = t(:notice_successful_update)
redirect_to action: :index
else
- @errors = call.errors
flash[:error] = call.errors.full_messages.join('\n')
render action: :edit
end
diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb
index d2936152867..91a5f2a68ce 100644
--- a/app/controllers/placeholder_users_controller.rb
+++ b/app/controllers/placeholder_users_controller.rb
@@ -91,7 +91,6 @@ class PlaceholderUsersController < ApplicationController
end
end
else
- @errors = service_result.errors
respond_to do |format|
format.html do
render action: :new
diff --git a/app/controllers/projects/settings/modules_controller.rb b/app/controllers/projects/settings/modules_controller.rb
index 5b113149925..e01d84f3fe1 100644
--- a/app/controllers/projects/settings/modules_controller.rb
+++ b/app/controllers/projects/settings/modules_controller.rb
@@ -39,7 +39,6 @@ class Projects::Settings::ModulesController < Projects::SettingsController
redirect_to project_settings_modules_path(@project)
else
- @errors = call.errors
render 'show'
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 5351ba35aeb..70a147646a5 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -102,7 +102,6 @@ class UsersController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to(params[:continue] ? new_user_path : helpers.allowed_management_user_profile_path(@user))
else
- @errors = call.errors
render action: 'new'
end
end
@@ -142,7 +141,6 @@ class UsersController < ApplicationController
@membership ||= Member.new
# Clear password input
@user = call.result
- @errors = call.errors
@user.password = @user.password_confirmation = nil
respond_to do |format|
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 6acc170bb73..9c01b54c8af 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -159,8 +159,6 @@ class VersionsController < ApplicationController
flash[:notice] = t(success_message)
redirect_back_or_version_settings
else
- @errors = call.errors
-
render action: failure_action
end
end
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 2928f4a8722..3499dd67f40 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -144,7 +144,6 @@ class WikiController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to_show
else
- @errors = call.errors
render action: 'new'
end
end
@@ -171,7 +170,6 @@ class WikiController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to_show
else
- @errors = call.errors
render action: 'edit'
end
rescue ActiveRecord::StaleObjectError
@@ -401,8 +399,10 @@ class WikiController < ApplicationController
end
def build_wiki_page
+ # Using the empty contract here as we use the method to instantiate the model, not to save it (new and new_child action).
+ # Errors are expected here as the user has not yet entered any data.
@page = WikiPages::SetAttributesService
- .new(model: WikiPage.new, user: current_user, contract_class: WikiPages::CreateContract)
+ .new(model: WikiPage.new, user: current_user, contract_class: EmptyContract)
.call(wiki: @wiki, title: wiki_page_title.presence, parent_id: flash[:_related_wiki_page_id])
.result
end
diff --git a/app/helpers/error_message_helper.rb b/app/helpers/error_message_helper.rb
index e71cf2aa553..b9a7bbc5479 100644
--- a/app/helpers/error_message_helper.rb
+++ b/app/helpers/error_message_helper.rb
@@ -37,17 +37,6 @@ module ErrorMessageHelper
render_error_messages_partial(object.errors, object)
end
- # Will take a contract to display the errors in a rails form.
- def error_messages_for_contract(object, errors)
- return unless errors
-
- # In order to have faulty field highlighted, the method sets
- # all errors in the contract on the object as well.
- object.errors.merge!(errors)
-
- render_error_messages_partial(errors, object)
- end
-
def render_error_messages_partial(errors, object)
return '' if errors.empty?
diff --git a/app/views/custom_actions/edit.html.erb b/app/views/custom_actions/edit.html.erb
index 864c30153a7..84ef8512abc 100644
--- a/app/views/custom_actions/edit.html.erb
+++ b/app/views/custom_actions/edit.html.erb
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<% local_assigns[:additional_breadcrumb] = t('custom_actions.edit', name: @custom_action.name) %>
<%= breadcrumb_toolbar t('custom_actions.edit', name: @custom_action.name) %>
-<%= error_messages_for_contract @custom_action, @errors %>
+<%= error_messages_for @custom_action %>
<%= labelled_tabular_form_for @custom_action do |f| %>
<%= render partial: 'form', locals: { f: f } %>
diff --git a/app/views/custom_actions/new.html.erb b/app/views/custom_actions/new.html.erb
index f4a3948d29d..08095ccfc61 100644
--- a/app/views/custom_actions/new.html.erb
+++ b/app/views/custom_actions/new.html.erb
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<% local_assigns[:additional_breadcrumb] = t('custom_actions.new') %>
<%= breadcrumb_toolbar t('custom_actions.new') %>
-<%= error_messages_for_contract @custom_action, @errors %>
+<%= error_messages_for @custom_action %>
<%= labelled_tabular_form_for @custom_action do |f| %>
<%= render partial: 'form', locals: { f: f } %>
diff --git a/app/views/oauth/applications/_form.html.erb b/app/views/oauth/applications/_form.html.erb
index 520bde2a977..c713375bce4 100644
--- a/app/views/oauth/applications/_form.html.erb
+++ b/app/views/oauth/applications/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @application, @errors %>
+<%= error_messages_for @application %>
<section class="form--section">
<div class="form--field -required">
diff --git a/app/views/placeholder_users/_form.html.erb b/app/views/placeholder_users/_form.html.erb
index 4881e070e1b..d2d03475dd2 100644
--- a/app/views/placeholder_users/_form.html.erb
+++ b/app/views/placeholder_users/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @placeholder_user, @errors %>
+<%= error_messages_for @placeholder_user %>
<!--[form:placeholder_user]-->
<section class="form--section">
diff --git a/app/views/projects/settings/modules/show.html.erb b/app/views/projects/settings/modules/show.html.erb
index 54a0ce79900..105e38e360d 100644
--- a/app/views/projects/settings/modules/show.html.erb
+++ b/app/views/projects/settings/modules/show.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= render partial: 'projects/settings/form_toolbar', locals: { form_name: "edit_project_#{@project.id}" } %>
<% end %>
-<%= error_messages_for_contract(@project, @errors) %>
+<%= error_messages_for(@project) %>
<%= labelled_tabular_form_for @project,
url: project_settings_modules_path(@project) do |form| %>
diff --git a/app/views/roles/_form.html.erb b/app/views/roles/_form.html.erb
index 7e9fa1aa9ce..8ac26c322e9 100644
--- a/app/views/roles/_form.html.erb
+++ b/app/views/roles/_form.html.erb
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<% roles ||= nil %>
-<%= error_messages_for_contract(role, @call.errors) if @call %>
+<%= error_messages_for(role) if @call %>
<div data-controller="admin--roles"
data-application-target="dynamic"
diff --git a/app/views/roles/report.html.erb b/app/views/roles/report.html.erb
index 218644687f6..62c57f97c4a 100644
--- a/app/views/roles/report.html.erb
+++ b/app/views/roles/report.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t(:label_permissions_report) %>
<% (@calls || []).select(&:failure?).each do |call| %>
- <%= error_messages_for_contract(call.result, call.errors) %>
+ <%= error_messages_for(call.result) %>
<% end %>
<%= form_tag(roles_path, method: :put, id: 'permissions_form') do %>
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 2119571c5b6..0a14bf3d67c 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @user, @errors %>
+<%= error_messages_for @user %>
<section class="form--section">
<%= render partial: 'users/form/basic_attributes', locals: { f: f } %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index 9ea2395ce1c..25703a1b89a 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= toolbar title: t(:label_user_new) %>
-<%= error_messages_for_contract @user, @errors %>
+<%= error_messages_for @user %>
<%= labelled_tabular_form_for @user,
url: { action: "create" },
diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb
index 5c45368e950..b7d6c8014d1 100644
--- a/app/views/versions/_form.html.erb
+++ b/app/views/versions/_form.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
contract = version_contract(version)
%>
-<%= error_messages_for_contract version, errors %>
+<%= error_messages_for version %>
<%= back_url_hidden_field_tag %>
<div class="form--field -required">
diff --git a/app/views/versions/edit.html.erb b/app/views/versions/edit.html.erb
index fc9058d1d28..92e8e3c5968 100644
--- a/app/views/versions/edit.html.erb
+++ b/app/views/versions/edit.html.erb
@@ -33,8 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= labelled_tabular_form_for @version do |f| %>
<%= render partial: 'form', locals: { f: f,
- project: @project,
- errors: @errors } %>
+ project: @project } %>
<%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>
<% end %>
diff --git a/app/views/versions/new.html.erb b/app/views/versions/new.html.erb
index 46924d17db9..a840abe51f6 100644
--- a/app/views/versions/new.html.erb
+++ b/app/views/versions/new.html.erb
@@ -33,8 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= labelled_tabular_form_for [@project, @version] do |f| %>
<%= render partial: 'versions/form', locals: { f: f,
- project: @project,
- errors: @errors } %>
+ project: @project } %>
<%= styled_button_tag t(:button_create), class: '-highlight -with-icon icon-checkmark' %>
<% end %>
diff --git a/app/views/wiki/_page_form.html.erb b/app/views/wiki/_page_form.html.erb
index cee6cacde36..c3211e91b5d 100644
--- a/app/views/wiki/_page_form.html.erb
+++ b/app/views/wiki/_page_form.html.erb
@@ -1,4 +1,4 @@
-<%= error_messages_for_contract @page, @errors %>
+<%= error_messages_for :page %>
<% resource = ::API::V3::WikiPages::WikiPageRepresenter.new(@page, current_user: current_user, embed_links: true) %>
@@ -42,4 +42,3 @@
{ controller: '/wiki', action: 'show', project_id: @project, id: (@page.new_record? ? nil : @page) },
data: { confirm: t(:text_are_you_sure) },
class: 'button -with-icon icon-cancel' %>
-
diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
index 439dc6c1886..d592cc8c9f2 100644
--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
@@ -140,7 +140,6 @@ module Bim
flash[:notice] = t('ifc_models.flash_messages.upload_successful')
redirect_to action: :index
else
- @errors = service_result.errors
render action: :new
end
end
@@ -160,7 +159,6 @@ module Bim
flash[:notice] = t(:notice_successful_update)
redirect_to action: :index
else
- @errors = service_result.errors
render action: :edit
end
end
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
index ef30a7c63e8..764f98578f4 100644
--- a/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= toolbar title: Bim::IfcModels::IfcModel.model_name.human %>
<%= labelled_tabular_form_for @ifc_model, url: bcf_project_ifc_model_path(@project, @ifc_model), method: 'PATCH' do |f| -%>
- <%= error_messages_for_contract @ifc_model, @errors %>
+ <%= error_messages_for @ifc_model %>
<%= render partial: 'form', locals: { f: f } %>
<%= styled_button_tag t(:button_save), class: "-highlight -with-icon icon-checkmark" %>
<% end %>
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb
index 0567412236b..a6e2f86457b 100644
--- a/modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= toolbar title: t('ifc_models.label_new_ifc_model') %>
<%= labelled_tabular_form_for @ifc_model, url: bcf_project_ifc_models_path(@project), html: { multipart: true } do |f| -%>
- <%= error_messages_for_contract @ifc_model, @errors %>
+ <%= error_messages_for @ifc_model %>
<%= render :partial => 'form', locals: { f: f } %>
<%= styled_button_tag t(:button_create), class: "-highlight -with-icon icon-checkmark" %>
<% end %>
diff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rb
index e253f5ba499..3c2d97d81ed 100644
--- a/modules/boards/app/controllers/boards/boards_controller.rb
+++ b/modules/boards/app/controllers/boards/boards_controller.rb
@@ -37,7 +37,6 @@ module ::Boards
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_work_package_board_path(@project, @board_grid)
else
- @errors = service_result.errors
render action: :new
end
end
diff --git a/modules/boards/app/views/boards/boards/_form.html.erb b/modules/boards/app/views/boards/boards/_form.html.erb
index 3f17083b6a6..7bd223f45f9 100644
--- a/modules/boards/app/views/boards/boards/_form.html.erb
+++ b/modules/boards/app/views/boards/boards/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @board_grid, @errors %>
+<%= error_messages_for @board_grid %>
<section class="form--section">
<div class="form--field -required">
diff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rb
index 84696af342a..4e26c68202b 100644
--- a/modules/budgets/app/controllers/budgets_controller.rb
+++ b/modules/budgets/app/controllers/budgets_controller.rb
@@ -109,7 +109,6 @@ class BudgetsController < ApplicationController
flash[:notice] = t(:notice_successful_create)
redirect_to(params[:continue] ? { action: 'new' } : { action: 'show', id: @budget })
else
- @errors = call.errors
render action: 'new', layout: !request.xhr?
end
end
@@ -128,7 +127,6 @@ class BudgetsController < ApplicationController
redirect_to(@budget)
else
@budget = call.result
- @errors = call.errors
render action: 'edit'
end
rescue ActiveRecord::StaleObjectError
diff --git a/modules/budgets/app/views/budgets/_form.html.erb b/modules/budgets/app/views/budgets/_form.html.erb
index 33e891c5bf2..a5623be647e 100644
--- a/modules/budgets/app/views/budgets/_form.html.erb
+++ b/modules/budgets/app/views/budgets/_form.html.erb
@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% resource = budget_attachment_representer(f.object) %>
-<%= error_messages_for_contract @budget, @errors %>
+<%= error_messages_for @budget %>
<div class="form--field -required">
<%= f.text_field :subject, required: true, autofocus: true, container_class: '-wide' %>
diff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rb
index c12ea9c21e9..168a6ac4435 100644
--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb
+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb
@@ -61,7 +61,6 @@ module ::Calendar
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_calendar_path(@project, @view.query)
else
- @errors = service_result.errors
render action: :new
end
end
diff --git a/modules/calendar/app/views/calendar/calendars/_form.html.erb b/modules/calendar/app/views/calendar/calendars/_form.html.erb
index aabe44cbe64..718215f2c41 100644
--- a/modules/calendar/app/views/calendar/calendars/_form.html.erb
+++ b/modules/calendar/app/views/calendar/calendars/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @view, @errors %>
+<%= error_messages_for @view %>
<section class="form--section">
diff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rb
index 75b3e0c935a..0123b265fdb 100644
--- a/modules/documents/app/controllers/documents_controller.rb
+++ b/modules/documents/app/controllers/documents_controller.rb
@@ -71,7 +71,6 @@ class DocumentsController < ApplicationController
redirect_to project_documents_path(@project)
else
@document = call.result
- @errors = call.errors
render action: 'new'
end
end
@@ -90,7 +89,6 @@ class DocumentsController < ApplicationController
redirect_to action: 'show', id: @document
else
@document = call.result
- @errors = call.errors
render action: 'edit'
end
end
diff --git a/modules/documents/app/views/documents/_form.html.erb b/modules/documents/app/views/documents/_form.html.erb
index e3f954126f7..94357169f44 100644
--- a/modules/documents/app/views/documents/_form.html.erb
+++ b/modules/documents/app/views/documents/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @document, @errors %>
+<%= error_messages_for @document %>
<div class="form--field -required">
<%= f.select :category_id,
diff --git a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
index 1964038f6a8..fa33ed89365 100644
--- a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
@@ -86,7 +86,6 @@ class Storages::Admin::AutomaticallyManagedProjectFoldersController < Applicatio
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to edit_admin_settings_storage_path(@storage)
else
- @errors = service_result.errors
render '/storages/admin/storages/automatically_managed_project_folders/edit'
end
end
diff --git a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
index 8de424d6b22..2131ab9baaa 100644
--- a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
@@ -63,7 +63,6 @@ class Storages::Admin::OAuthClientsController < ApplicationController
@oauth_client = service_result.result
service_result.on_failure do
- @errors = service_result.errors
render '/storages/admin/storages/new_oauth_client'
end
diff --git a/modules/storages/app/controllers/storages/admin/project_storages_controller.rb b/modules/storages/app/controllers/storages/admin/project_storages_controller.rb
index 6fe1334f80e..f2fc25f6ee0 100644
--- a/modules/storages/app/controllers/storages/admin/project_storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/project_storages_controller.rb
@@ -94,7 +94,6 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsController
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_settings_project_storages_path
else
- @errors = service_result.errors
@project_storage = service_result.result
@available_storages = available_storages
render '/storages/project_settings/new'
@@ -131,7 +130,6 @@ class Storages::Admin::ProjectStoragesController < Projects::SettingsController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to project_settings_project_storages_path
else
- @errors = service_result.errors
@project_storage = @object
render '/storages/project_settings/edit'
end
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index 9ba2273853f..52e5b4f0dea 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -80,7 +80,6 @@ class Storages::Admin::StoragesController < ApplicationController
@oauth_application = oauth_application(service_result)
service_result.on_failure do
- @errors = service_result.errors
render :new
end
@@ -119,7 +118,6 @@ class Storages::Admin::StoragesController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to edit_admin_settings_storage_path(@storage)
else
- @errors = service_result.errors
render :edit
end
end
@@ -147,7 +145,6 @@ class Storages::Admin::StoragesController < ApplicationController
@oauth_application = service_result.result
render :show_oauth_application
else
- @errors = service_result.errors
render :edit
end
end
diff --git a/modules/storages/app/views/storages/admin/storages/_new.html.erb b/modules/storages/app/views/storages/admin/storages/_new.html.erb
index a65c1f51dc9..2a58d2c225e 100644
--- a/modules/storages/app/views/storages/admin/storages/_new.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/_new.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
%>
<!-- Included form for create and edit operations, please see the controller for comments -->
-<%= error_messages_for_contract @storage, @errors %>
+<%= error_messages_for @storage %>
<fieldset class="form--fieldset" data-storages--storage-form-target="fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:label_general) %></legend>
diff --git a/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb b/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
index 3872626d2a1..0b9eba91b59 100644
--- a/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
@@ -36,7 +36,7 @@ See COPYRIGHT and LICENSE files for more details.
subtitle: t("storages.page_titles.managed_project_folders.subtitle")
%>
-<%= error_messages_for_contract @storage, @errors %>
+<%= error_messages_for @storage %>
<%= labelled_tabular_form_for @storage, url: admin_settings_storage_automatically_managed_project_folders_path(@storage),
method: :patch,
diff --git a/modules/storages/app/views/storages/admin/storages/nextcloud/_edit.html.erb b/modules/storages/app/views/storages/admin/storages/nextcloud/_edit.html.erb
index 5418e500dec..177cd4b5c68 100644
--- a/modules/storages/app/views/storages/admin/storages/nextcloud/_edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/nextcloud/_edit.html.erb
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @storage, @errors %>
+<%= error_messages_for @storage %>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:label_general) %></legend>
diff --git a/modules/storages/app/views/storages/admin/storages/one_drive/_edit.html.erb b/modules/storages/app/views/storages/admin/storages/one_drive/_edit.html.erb
index 3dc015426e8..24ba1479602 100644
--- a/modules/storages/app/views/storages/admin/storages/one_drive/_edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/one_drive/_edit.html.erb
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @storage, @errors %>
+<%= error_messages_for @storage %>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:label_general) %></legend>
diff --git a/modules/storages/app/views/storages/project_settings/edit.html.erb b/modules/storages/app/views/storages/project_settings/edit.html.erb
index ea578622da6..9ced3b572b2 100644
--- a/modules/storages/app/views/storages/project_settings/edit.html.erb
+++ b/modules/storages/app/views/storages/project_settings/edit.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<% local_assigns[:additional_breadcrumb] = t('storages.label_edit_storage') %>
<%= toolbar title: t("storages.page_titles.project_settings.edit") %>
-<%= error_messages_for_contract @project_storage, @errors %>
+<%= error_messages_for @project_storage %>
<%= labelled_tabular_form_for @project_storage, url: project_settings_project_storage_path(project_id: @project_storage.project, id: @project_storage) do |f| -%>
<section class="form--section">
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 d38b1ad9f91..c4ff4690694 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
@@ -32,7 +32,6 @@ module ::TeamPlanner
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to project_team_planner_path(@project, @view.query)
else
- @errors = service_result.errors
render action: :new
end
end
diff --git a/modules/team_planner/app/views/team_planner/team_planner/_form.html.erb b/modules/team_planner/app/views/team_planner/team_planner/_form.html.erb
index ca2ea31b4d3..97bc669d4bb 100644
--- a/modules/team_planner/app/views/team_planner/team_planner/_form.html.erb
+++ b/modules/team_planner/app/views/team_planner/team_planner/_form.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= error_messages_for_contract @view, @errors %>
+<%= error_messages_for @view %>
<section class="form--section">
diff --git a/spec/controllers/custom_actions_controller_spec.rb b/spec/controllers/custom_actions_controller_spec.rb
index 5e96c89180a..daac2c583ed 100644
--- a/spec/controllers/custom_actions_controller_spec.rb
+++ b/spec/controllers/custom_actions_controller_spec.rb
@@ -209,11 +209,6 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
expect(assigns[:custom_action])
.to eql action
end
-
- it 'assigns errors' do
- expect(assigns[:errors])
- .to eql service_result.errors
- end
end
end
@@ -350,11 +345,6 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
expect(assigns[:custom_action])
.to eql(action)
end
-
- it 'assigns errors' do
- expect(assigns[:errors])
- .to eql service_result.errors
- end
end
end
diff --git a/spec/controllers/placeholder_users_controller_spec.rb b/spec/controllers/placeholder_users_controller_spec.rb
index 2e726b55da7..f59a51395e3 100644
--- a/spec/controllers/placeholder_users_controller_spec.rb
+++ b/spec/controllers/placeholder_users_controller_spec.rb
@@ -105,7 +105,7 @@ RSpec.describe PlaceholderUsersController do
expect { post :create, params: }.not_to change { PlaceholderUser.count }
expect(response).to be_successful
- expect(assigns(:errors).details[:base])
+ expect(assigns(:placeholder_user).errors.details[:base])
.to eq([error: :error_enterprise_only, action: "Placeholder Users"])
end
end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 88ff1f0faf1..acf02650770 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -697,7 +697,7 @@ RSpec.describe UsersController do
it 'renders the edit template with errors' do
expect(response)
.to have_rendered('edit')
- expect(assigns(:errors).first)
+ expect(assigns(:user).errors.first)
.to have_attributes(attribute: :firstname, type: :blank)
end
end
diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rb
index e878dc32194..a81ea3ea70e 100644
--- a/spec/controllers/versions_controller_spec.rb
+++ b/spec/controllers/versions_controller_spec.rb
@@ -343,7 +343,7 @@ RSpec.describe VersionsController do
it { expect(response).to be_successful }
it { expect(response).to render_template('edit') }
- it { expect(assigns(:errors).symbols_for(:name)).to match_array([:blank]) }
+ it { expect(assigns(:version).errors.symbols_for(:name)).to contain_exactly(:blank) }
end
end
diff --git a/spec/helpers/error_message_helper_spec.rb b/spec/helpers/error_message_helper_spec.rb
index 2fbc30758d1..30a10b92960 100644
--- a/spec/helpers/error_message_helper_spec.rb
+++ b/spec/helpers/error_message_helper_spec.rb
@@ -97,14 +97,6 @@ RSpec.describe ErrorMessageHelper do
end
end
- describe '#error_messages_for_contract' do
- let(:errors) { ActiveModel::Errors.new(model) }
-
- subject(:rendered) { helper.error_messages_for_contract(model, errors) }
-
- include_examples 'error messages rendering'
- end
-
describe '#error_messages_for' do
let(:errors) { model.errors }