]> source.dussan.org Git - redmine.git/commitdiff
Support of default ActiveRecord I18n scopes in LabelledFormBuilder (#26618).
authorGo MAEDA <maeda@farend.jp>
Mon, 4 Jun 2018 02:26:48 +0000 (02:26 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 4 Jun 2018 02:26:48 +0000 (02:26 +0000)
Patch by Dmitry Lisichkin.

git-svn-id: http://svn.redmine.org/redmine/trunk@17365 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/views/labelled_form_builder.rb

index 7481d79b85db1f42abc925d1c8568143a2d158c1..d7aff9a6b0e5e9cbfd76afad35ce95c9d84d8d57 100644 (file)
@@ -55,7 +55,7 @@ class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
   def label_for_field(field, options = {})
     return ''.html_safe if options.delete(:no_label)
     text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label]
-    text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym)
+    text ||= @object.class.human_attribute_name(field)
     text += @template.content_tag("span", " *", :class => "required") if options.delete(:required)
     @template.content_tag("label", text.html_safe,
                                    :class => (@object && @object.errors[field].present? ? "error" : nil),