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

Update `ApplicationForm#attribute_name` method signature to be less restrictive

Kabiru Mwenja94c4e1c5df56
diff --git a/app/forms/application_form.rb b/app/forms/application_form.rb
index dca8cc16204..5a57561efa7 100644
--- a/app/forms/application_form.rb
+++ b/app/forms/application_form.rb
@@ -47,10 +47,11 @@ class ApplicationForm < Primer::Forms::Base
@builder.object
end
- # @param field_name [Symbol] the name of the attribute for which to retrieve
- # the human-readable name
- # @return [String] the human-readable name of the specified attribute
- def attribute_name(field_name)
- model.class.human_attribute_name(field_name)
+ # Forwards all arguments to ActiveRecord's human_attribute_name.
+ #
+ # @param args [Array] Arguments to pass to human_attribute_name (e.g., attribute name, options)
+ # @return [String] The human-readable name of the specified attribute
+ def attribute_name(...)
+ model.class.human_attribute_name(...)
end
end
diff --git a/app/forms/my/look_and_feel_form.rb b/app/forms/my/look_and_feel_form.rb
index d9f9d30e12b..2ba5c6b3510 100644
--- a/app/forms/my/look_and_feel_form.rb
+++ b/app/forms/my/look_and_feel_form.rb
@@ -94,8 +94,4 @@ class My::LookAndFeelForm < ApplicationForm
attribute_name(:disable_keyboard_shortcuts_caption_html,
href: OpenProject::Static::Links.url_for(:shortcuts)).html_safe # rubocop:disable Rails/OutputSafety
end
-
- def attribute_name(...)
- UserPreference.human_attribute_name(...)
- end
end