Thursday, May 6, 2010

[Rails] error message of a child object

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?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate