Verwendung: Rails 3.0.3 Ruby 1.9.2Rails 3 I18n Label Übersetzung für nested_attributes in has_many Beziehung
Hier ist die Beziehung:
class Person < ActiveRecord::Base
has_many :contact_methods
accepts_nested_attributes_for :contact_methods
end
class ContactMethod < ActiveRecord::Base
attr_accessible :info
belongs_to :person
end
Jetzt, wenn ich versuche, die contact_method Etiketten in I18n anpassen Es erkennt es nicht.
en:
helpers:
label:
person[contact_methods_attributes]:
info: 'Custom label here'
Ich habe auch versucht:
person[contact_method_attributes]
Dies funktioniert gut für 1-1 Beziehungen, z.B.
person[wife_attributes]:
name: 'My wife'
aber nicht person[wives_attributes]
Vielen Dank im Voraus
In Rails 3.2.12 konnte ich nicht: 'helpers.label.person.contact_method.info' funktionieren, aber: 'helpers.label.person [contact_method_attributes] .info' tut. (Das war für has_one; ich habe nicht mit has_many Beziehung versucht.) – graywh
In Rails 3.1.10 konnte ich bekommen: 'helpers.label.person.contact_methods.info' zu arbeiten, musste aber: 'helpers.label .person [contact_methods_attributes] [new_contact_methods] 'für meine javascript-addable has_many-Verknüpfung. (Die "new_contact_methods" ist ein Platzhalter für die ID, wenn die Vorlage für das Dateninhalt-Attribut meiner Schaltfläche gerendert wird, die die Felder dem DOM hinzufügt.) – graywh