Sha256: e1e900a25a4bd0e7c460f0d37d14b88513a84855f08e8b2d090d2a80be38e76d
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
class TranslationKey < ActiveRecord::Base has_many :translations, :class_name => 'TranslationText', :dependent => :destroy accepts_nested_attributes_for :translations, :allow_destroy => true validates_uniqueness_of :key validates_presence_of :key attr_accessible :key, :translations, :translations_attributes 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fast_gettext-0.6.9 | lib/fast_gettext/translation_repository/db_models/translation_key.rb |