Sha256: 32f424c8795913d0b289a91cb85e59d34e6ddc15215aecea41817c412f30ce2f

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

module FastGettext::TranslationRepository
  module DBModels
    class TranslationKey < ActiveRecord::Base
      has_many :translations, :class_name=>'TranslationText'
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grosser-fast_gettext-0.4.4 lib/fast_gettext/translation_repository/db_models/translation_key.rb