jeudi 21 mai 2015

Multiple table inheritance, ActiveRecord translation on yml files

Developing on rails, using multiple table inheritance with this gem. I need to localize ActiveRecord model and attributes in both .en and .es yml files, but I can't figure how to do this, neither I have found any clue.

class Animal < ActiveRecord::Base
  acts_as_superclass

end

class Animal::Dog < ActiveRecord::Base
  inherits_from :animal, :methods => true

end

All locales defined on yml files only work for superclass. Further attempts to define subclass locales, or to get superclass locales inherited by subclasses have failed.

en:
  activerecord:
    models:
      animal:
        one: Animal
        other: Animals

    attributes:
      animal:
        name: Name

        dog: #not working

      dog: #not working
      animals_dog: #not working
      animal_dog: #not_working

es:
  activerecord:
    models:
      animal:
        one: Animal
        other: Animales

    attributes:
      animal:
        name: Nombre

Aucun commentaire:

Enregistrer un commentaire