Sha256: a87312b3a18497bf2e346833e4e7e2b2361cc95403767a9dae5c1d4a3d8d6afd
Contents?: true
Size: 384 Bytes
Versions: 3
Compression:
Stored size: 384 Bytes
Contents
module TranslatableRecords module Concern extend ActiveSupport::Concern def locale=(value) if value.present? @locale = value.to_s else @locale = nil end end def locale @locale || I18n.locale.to_s end def find_translation(locale) translations.to_a.group_by(&:locale)[locale.to_s].try :first end end end
Version data entries
3 entries across 3 versions & 1 rubygems