Sha256: 1d11bca9bc37428b29560fdb65136a5fbef6372d509629bc374c76428c402204
Contents?: true
Size: 560 Bytes
Versions: 17
Compression:
Stored size: 560 Bytes
Contents
class TranslationKey < ActiveRecord::Base has_many :translations, :class_name => 'TranslationText' accepts_nested_attributes_for :translations, :allow_destroy => true validates_uniqueness_of :key validates_presence_of :key def self.translation(key, locale) return unless translation_key = find_by_key(key) return unless translation_text = translation_key.translations.find_by_locale(locale) translation_text.text end def self.available_locales @@available_locales ||= TranslationText.count(:group=>:locale).keys.sort end end
Version data entries
17 entries across 17 versions & 1 rubygems