Search code examples
ruby-on-railsinternationalizationactive-attr

How to translate attributes of table-less model?


RailsCast #326 ActiveAttr explains how to create table-less models.

How can one translate the attributes as it is explained for table-based attributes in the rails docs?


Solution

  • Instead of going via ActiveRecord (e.g. de.activerecord.attributes.message.subject: Betreff), ActiveModel has to be referenced (e.g. de.activemodel.attributes.message.subject: Betreff).

    -- outlined by stephenmurdoch in this comment