Sha256: a732e9eda1165a11cbdada7afc1cf5c952d3351616208d397b529b59586354ac
Contents?: true
Size: 389 Bytes
Versions: 16
Compression:
Stored size: 389 Bytes
Contents
module Alchemy::Language::Code extend ActiveSupport::Concern def code [language_code, country_code].select(&:present?).join('-') end def code=(code) self.language_code = code end module ClassMethods def find_by_code(code) codes = code.split('-') codes << nil if codes.length == 1 find_by_language_code_and_country_code *codes end end end
Version data entries
16 entries across 16 versions & 1 rubygems