public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Introduced AR::Base.human_name to validations
iain (author)
Sat Aug 16 11:22:40 -0700 2008
svenfuchs (committer)
Wed Aug 20 08:39:43 -0700 2008
commit  c531248938302477c5e52138d59a6c3d1527d963
tree    547c8ece3d9979f781c51086e108347466ca378d
parent  ae8a35d8f6d5db6ae9a1877918d45c15d21e24fe
...
100
101
102
103
 
104
105
106
...
100
101
102
 
103
104
105
106
0
@@ -100,7 +100,7 @@ module ActiveRecord
0
 
0
       options.merge!({ 
0
           :default => defaults,
0
-          :model => I18n.translate(model_name.underscore, :default => model_name.humanize, :scope => [:activerecord, :models], :count => 1),
0
+          :model => @base.class.human_name,
0
           :attribute => @base.class.human_attribute_name(attribute.to_s),
0
           :scope => [:activerecord, :errors, :messages] })
0
 
...
46
47
48
49
 
50
51
52
...
54
55
56
57
 
58
59
60
...
46
47
48
 
49
50
51
52
...
54
55
56
 
57
58
59
60
0
@@ -46,7 +46,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase
0
       global_scope = [:activerecord, :errors, :messages]
0
       custom_scope = global_scope + [:custom, 'topic', :title]
0
 
0
-      I18n.expects(:translate).with('topic', {:count => 1, :default => 'Topic', :scope => [:activerecord, :models]}).returns('Topic')
0
+      I18n.expects(:translate).with(:topic, {:count => 1, :default => ['Topic'], :scope => [:activerecord, :models]}).returns('Topic')
0
       I18n.expects(:translate).with(:'topic.title', {:count => 1, :default => ['Title'], :scope => [:activerecord, :attributes]}).returns('Title')
0
       I18n.expects(:translate).with(:"custom.topic.title.invalid", :scope => global_scope, :default => [:"custom.topic.invalid", 'default from class def error 1', :invalid], :attribute => "Title", :model => "Topic").returns('default from class def error 1')
0
       @topic.errors.generate_message :title, :invalid, :default => 'default from class def error 1'
0
@@ -54,7 +54,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase
0
 
0
     def test_errors_generate_message_translates_custom_model_attribute_keys_with_sti
0
       custom_scope = [:activerecord, :errors, :custom, 'topic', :title]
0
-      I18n.expects(:translate).with('reply', {:count => 1, :default => 'Reply', :scope => [:activerecord, :models]}).returns('Reply')
0
+      I18n.expects(:translate).with(:reply, {:count => 1, :default => [:topic, 'Reply'], :scope => [:activerecord, :models]}).returns('Reply')
0
       I18n.expects(:translate).with(:'reply.title', {:count => 1, :default => [:'topic.title', 'Title'], :scope => [:activerecord, :attributes]}).returns('Title')
0
       I18n.expects(:translate).with(:"custom.reply.title.invalid", :scope => [:activerecord, :errors, :messages], :default => [:"custom.reply.invalid", :"custom.topic.title.invalid", :"custom.topic.invalid", 'default from class def', :invalid], :model => 'Reply', :attribute => 'Title').returns("default from class def")
0
       Reply.new.errors.generate_message :title, :invalid, :default => 'default from class def'

Comments