##// END OF EJS Templates
Support of default Active Record (I18n) transliteration paths (#22383)....
Jean-Philippe Lang -
r14948:223141a20b27
parent child
Show More
@@ -4,9 +4,23 module ActiveRecord
4 class Base
4 class Base
5 include Redmine::I18n
5 include Redmine::I18n
6 # Translate attribute names for validation errors display
6 # Translate attribute names for validation errors display
7 def self.human_attribute_name(attr, *args)
7 def self.human_attribute_name(attr, options = {})
8 attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
8 prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
9 l("field_#{name.underscore.gsub('/', '_')}_#{attr}", :default => ["field_#{attr}".to_sym, attr])
9
10 redmine_default =
11 [
12 :"field_#{name.underscore.gsub('/', '_')}_#{prepared_attr}",
13 :"field_#{prepared_attr}"
14 ]
15
16 if options[:default].present?
17 options[:default] = [options[:default]] unless options[:default].is_a? Array
18 options[:default].unshift redmine_default
19 else
20 options[:default] = redmine_default
21 end
22
23 super
10 end
24 end
11 end
25 end
12
26
@@ -57,7 +57,7 class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base
57 end
57 end
58
58
59 assert_response :unprocessable_entity
59 assert_response :unprocessable_entity
60 assert_select 'errors error', :text => /relation_type is not included in the list/
60 assert_select 'errors error', :text => /Relation type is not included in the list/
61 end
61 end
62
62
63 test "GET /relations/:id.xml should return the relation" do
63 test "GET /relations/:id.xml should return the relation" do
General Comments 0
You need to be logged in to leave comments. Login now