Slide 44
Slide 44 text
“Plugging In”: Model Setup
class Post
translates :title, fallbacks: true, dirty: true
translates :subtitle, backend: :column
translates :body, locale_accessors: [:en, :de], cache: false
end
class Post
translates :title, fallbacks: true, dirty: true
translates :subtitle, backend: :column
translates :body, locale_accessors: [:en, :de], cache: false
end
class Post
has_many :mobility_text_translations,
where: { key: [:title, :body] },
as: :translatable,
class_name: ::Mobility::ActiveRecord::TextTranslation
end
class Post
has_many :mobility_text_translations,
where: { key: [:title, :body] },
as: :translatable,
class_name: ::Mobility::ActiveRecord::TextTranslation
end
backend_class.setup_model(Post, :title, fallbacks: true, dirty: true)