How is it possible to localise nested virtual attribute in Rails?
The model:
class User < ActiveRecord::Base
attr_accessor :company_information # This is used in callbacks etc
end
and the view:
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f|
= devise_error_messages!
= f.input :email
= f.input :password
= f.input :password_confirmation
= f.simple_fields_for :company_information do |c|
= c.input :name # This is what I want to localise
= f.button :submit
The translation keys (from en.yml
) like activerecord.attributes.user.company_information.name
and activerecord.attributes.user.company_information_name
aren't picked up.