0

We are using Rails 3.2.15 and Globalize gem for I18N. We recently integrated Paper Trail Gem for auditing Model changes.

We observed that whichever model fields are marked as translated are not updated in DB.

e.g.

class MyModel < ActiveRecord::Base
  translates :name
  has_paper_trail
end

When I update the name attribute of MyModel object, it is not saved.

Versions:

Ruby 1.9.3

Rails 3.2.15

Globalize3

paper_trail 2.7.2

Sid
  • 4,893
  • 14
  • 55
  • 110
  • The `globalize` gem doesn't store the translated texts in the model's table but in an dedicated translations table. That means changing a translation doesn't update the model itself, therefore `papertrail` has no chance to notice that there was a change. You would have to extent the translations model to use papertrail too. – spickermann Apr 20 '17 at 08:11
  • The translations don't have any models per say. the gem handles it internally – Sid Apr 20 '17 at 09:34

1 Answers1

0

I got it to work by upgrading my Globalize gem and installing the globalize-versioning gem. It works quite well together.

class MyModel < ActiveRecord::Base
  translates :name, versioning: :paper_trail
  has_paper_trail
end

This does require you to get versions for translated items with my_model.translations.versions instead of the usual my_model.versions.

Sid
  • 4,893
  • 14
  • 55
  • 110