Sha256: 1ef5c8bf1357d2d997c77c090d190759abe72280ebd0ca260912f7e7b23ed222
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
module I18nline class Translation < ActiveRecord::Base after_save :update_caches attr_accessor :make_nil serialize :value serialize :interpolations, Array default_scope { order("created_at desc") } def self.not_translated(apply_this = "1") if apply_this.present? where("value is null") else self.all end end def self.blank_value(apply_this = "1") if apply_this.present? #value is serialized so searching for empty is complicated: where("value like ?", "".to_yaml) else self.all end end def self.in_locale(locale) if locale.present? where("locale = ?", locale) else self.all end end def self.search_key(to_search) if to_search.present? where("key like ?", "%#{to_search}%") else self.all end end def self.search_value(to_search) if to_search.present? where("value like ?", "%#{to_search}%") else self.all end end def update_caches TRANSLATION_STORE.reload! end end end
Version data entries
5 entries across 5 versions & 1 rubygems