Access translation file (i18n) from inside rails model
Call:
I18n.t
instead of simple t
. t
is a helper method only available in the views, delegating the whole logic to I18n
module.
UPDATE:
As mentioned in the comments, view helper is not only delegating to the I18n
module, it makes sure that you can use a default scopes as well.
# constantsdef self.option_enum [ [ I18n.t('enum.amount'), 'A' ], [ I18n.t('enum.percentage'), 'P' ] ]end