# Error message of a child object

**URL:** <https://www.ruby-forum.com/t/error-message-of-a-child-object/188183>\
**Category:** Rails\
**Created:** [May 7, 2010, 1:50am UTC](https://www.ruby-forum.com/t/error-message-of-a-child-object/188183 "2010-05-07T01:50:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oreng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8e8cbc/32.png) [@oreng](https://www.ruby-forum.com/u/oreng)\
**Post date:** [May 7, 2010, 1:50am UTC](https://www.ruby-forum.com/t/error-message-of-a-child-object/188183/1 "2010-05-07T01:50:32Z")

</div>

class TranslationKey \< ActiveRecord::Base  
has\_many :key\_values  
has\_many :translation\_values, :through =\> :key\_values  
validates\_uniqueness\_of :name, :message =\> “already exist in another  
key”  
end

class TranslationValue \< ActiveRecord::Base  
has\_many :key\_values  
has\_many :translation\_keys, :through =\> :key\_values  
has\_many :languages  
validates\_presence\_of :text, :message =\> “can’t be empty”  
end

in my update action of Key, if the key has non-valid value object I  
see this error message:  
“Translation values is invalid”

why don’t I see: “already exist in another key” instead?

---

<div class="post-metadata">

**Author:** ![oreng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8e8cbc/32.png) [@oreng](https://www.ruby-forum.com/u/oreng)\
**Post date:** [May 7, 2010, 7:32am UTC](https://www.ruby-forum.com/t/error-message-of-a-child-object/188183/2 "2010-05-07T07:32:17Z")

</div>

On 7 May 2010 00:49, oren [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> in my update action of Key, if the key has non-valid value object I  
> see this error message:  
> “Translation values is invalid”
> 
> why don’t I see: “already exist in another key” instead?

Have a look at this thread from last week, which is the same question.

[http://groups.google.com/group/rubyonrails-talk/browse\_thread/thread/cb995e54c0fe16db/59c3189a80fb0b69](http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/cb995e54c0fe16db/59c3189a80fb0b69)

---

<div class="post-metadata">

**Author:** ![oreng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/8e8cbc/32.png) [@oreng](https://www.ruby-forum.com/u/oreng)\
**Post date:** [May 7, 2010, 7:46pm UTC](https://www.ruby-forum.com/t/error-message-of-a-child-object/188183/3 "2010-05-07T19:46:54Z")

</div>

thanks, looking into this thread.
