AR validates_uniqueness_of's :message


#1

Hello,

Can anybody give me a hint on the format of :message? I have:

validates_uniqueness_of :username, :scope => :group, :case_sensitive
=> false,
:message => “%{fn} already exists in %{fn}.”

I get “Userame already exists in Userame.” Yuck!

When creating a duplicate with create(:username => ‘userA’, :group =>
‘groupB’), how can I make it “userA already exists in groupB.” ???

By the way, where are the :message format and the usage of %{fn} and %d
documented? I’ve tried AWDWR 2nd ed., PickAxeII and Rails docs…

Thanks in advance!


#2

Does anybody know where the usage %{fn} and %d in :message are
documented?