require "active_record/mlang" module ActiveRecord module Mlang class Lang < ActiveRecord::Base include ActiveRecord::Mlang def self.[] locale_or_lang_id if locale_or_lang_id.kind_of? Integer self.find_by(id: locale_or_lang_id) else self.find_by(code: locale_or_lang_id) end end end end end