Sha256: b087cf32bdfd303839ed68df6a5db5f849073415c77b199f7cce1717a34c625d
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
module ExpressTranslate # Construction # code: no_one # text: Number one.... class LanguageDetail < ExpressTranslateModel @name = "lang_package_id" @primary = "code" @attr = "text" @lang = {} def self.info(lang) @lang = lang self.name = "lang_#{lang['packages']}_#{lang['id']}" return self end def self.add(params) return self.sync_i18n(params, super(params)) end def self.update(params) return self.sync_i18n(params, super(params)) end def self.delete(code) delete = super(code) Database.redis.del("#{@lang['packages']}#{@lang['id']}.#{code}") if delete["success"] return delete end def self.destroy super keys = Database.redis.keys([@name, ".*"].join) keys.each do |key| Database.redis.del(key) end end private def self.sync_i18n(params, check) Database.redis.set("#{@lang['packages']}#{@lang['id']}.#{params[:code]}", params[:text].to_json) if check["success"] return check end end end
Version data entries
13 entries across 13 versions & 1 rubygems