Sha256: 178f8bcee757a857657cb2242e0df21c41e39b41ed94fdfa1a4a8f11a70d3126
Contents?: true
Size: 573 Bytes
Versions: 6
Compression:
Stored size: 573 Bytes
Contents
module SimpleModelTranslations module InstanceMethods def find_translation_by_locale(locale) translations.detect { |t| t.locale.to_sym == locale } end def find_or_build_translation_by_locale(locale) find_translation_by_locale(locale) || build_translation_for_locale(locale) end def build_translation_for_locale(locale) translations.build(:locale => locale) end def current_locale_for_translation I18n.locale end def default_locale_for_translation I18n.default_locale end end end
Version data entries
6 entries across 6 versions & 1 rubygems