Remove ProgressBar overrided translation class

Since Globalize gem update to v5.2.0 we cannot override translations
anymore in the same way that before the update. Milestone::Translation
class removed in this commit were no longer loaded correctly when
translation class is retrieved by translation_class method provided by
Globalize. Here is the diff between both gem versions:

https://github.com/globalize/globalize/compare/v5.0.0...v5.2.0diff-a1370b109e0dd567545b072bc6447b8fR51

This problem is not happening on test environment but is throwing an
exception in other environments as it has not loaded the delegation
definition inside our custom translation class.

To fix this we added a new class method inside globalizable model
concern to allow to define method delegation on translations classes from
parent globalizable classes when needed without having to override
Translation classes.
This commit is contained in:
Julian Herrero
2019-03-25 17:29:24 +01:00
parent 700f271a36
commit 01a9ba4a87
2 changed files with 1 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ class ProgressBar < ActiveRecord::Base
translates :title, touch: true
include Globalizable
translation_class_delegate :primary?
validates :progressable, presence: true
validates :kind, presence: true,

View File

@@ -1,3 +0,0 @@
class ProgressBar::Translation < Globalize::ActiveRecord::Translation
delegate :primary?, to: :globalized_model
end