(Rails 2.3.8)
Say I have in config/locales/en.yml:
en:
activerecord:
attributes:
foo:
bar: 'Long%{br}name'
Now, in HTML I can do:
t(:'activerecord.attributes.foo.bar', :br => '<br/>')
and in LaTeX:
t(:'activerecord.attributes.foo.bar', :br => '\\\\')
However, this is doomed to fail with AR validations, e.g.:
# Model
class Foo < ActiveRecord::Base
validates_presence_of :bar
end
# View Error
I18n::MissingInterpolationArgument in Foo#create
missing interpolation argument in "Long%{br}name" ({:count=>"1"} given)
So how do I pass :br to 'activerecord.attributes.foo.bar' in the context
of Foo?
Or is my approach wrong altogether?
Thank you
--
Posted via http://www.ruby-forum.com/.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.